Re: Hard link and disk usage



On Wed, 11 Apr 2007 17:19:38 +0200 Michael Schnell <mschnell_at_lumino_dot_de@xxxxxxxxxxx> wrote:

| I understand that the size of a directory is just a virtual number,
| adding the size of all files that are accessible within that directory.
| Thus doing a hard link to an existing file in the same directory will
| increase the directory size but not the used disk size. On a disk with
| many hard links the size of a single directory might be much higher than
| the drive capacity.

That depends on whether the tool used to add up those numbers also takes
into account the hard links. The "du" command I have tries to do that.
It also does it badly when hardlinks to the same file are in different
directories: it counts the whole file in the total for the first directory
but not for the next directory. But there is no clear right way to show
this for files with hard links spanning directories. Once the total gets
up to a parent directory covering all links to the file, then the figure
should be correct from a hard link aware "du".

--
|---------------------------------------/----------------------------------|
| Phil Howard KA9WGN (ka9wgn.ham.org) / Do not send to the address below |
| first name lower case at ipal.net / spamtrap-2007-04-23-1117@xxxxxxxx |
|------------------------------------/-------------------------------------|
.



Relevant Pages

  • Re: why it has the hard links?
    ... Deleting a file from a Unix filesystem is ... nothing more than marking some disk sectors free for reuse! ... bit) one reason why I tend to use symlinks more often than hard links ...
    (comp.os.linux.misc)
  • Re: hard links and symbolic links
    ... > "One big advantage of hard links is that they don't use any disk ... A symbolic link is implemented as a file containing the name of the ... The size of a symlink is related to the length of the name of the ...
    (comp.unix.shell)
  • Re: [opensuse] Another back-up question - Over & over again
    ... I thought the task was to replicate a file system from one disk ... from one disk to the same disk after repair - but I don't ... differentiate them from symlinks. ... hard links are not special entities. ...
    (SuSE)
  • Re: [9fans] Q: moving directories? hard links?
    ... absolutely requires hard links? ... A file system would be an ideal way to represent the data, ... Not a disk FS, just a naming FS. ...
    (comp.os.plan9)
  • Need copy tool for heavily hardlinked disk
    ... I need a fast hard disk copy tool, ... I have a hard drive partition with 170GB of data in it. ... has an enormous number of hard links in it, ...
    (Fedora)