Can I create a link to an inode?

Patrick O'Callaghan pocallaghan at gmail.com
Fri Aug 15 23:43:01 UTC 2008


On Fri, 2008-08-15 at 15:05 -0700, Konstantin Svist wrote:
> Patrick O'Callaghan wrote:
> > On Fri, 2008-08-15 at 13:42 -0500, Doug Wyatt wrote:
> >   
> >> I think I read, somewhere, that in doing that I could end up
> >> with garbage bytes at the end of the last block in the copy,
> >> and would need to use the size from the original inode to
> >> trim the copied file.  Don't know if that's fact or not.
> >>     
> >
> > I can't imagine why that would be true. A file is a file is a file.
> >   
> 
> The file doesn't occupy the entire last sector in most filesystems. 
> Maybe that's what was meant originally as garbage bytes - the whole file 
> is there, plus the (supposedly) empty remainder of the last sector.

The location of the last sector is irrelevant. All Unix/Linux
filesystems keep the exact size of the file in bytes as a field in the
inode (AFAIK this is a POSIX requirement). The inode hasn't disappeared,
it just doesn't have any links to it, thus the system will not allow
processes to read past the end of the allocated space, even if it's in
the middle of a sector.

This is true no matter where the file is physically.

poc




More information about the fedora-list mailing list