add another hard disk on Fedora Linux

James Wilkinson fedora at westexe.demon.co.uk
Fri Nov 18 13:07:39 UTC 2005


Tim wrote:
> I notice zcat is a link, but gzip and gunzip *appear* to be standalone
> files:
> 
> $ ll /usr/bin/bzcat
> lrwxrwxrwx  1 root root     5 Oct 18 10:26 /usr/bin/bzcat -> bzip2
> 
> $ ll /bin/gzip
> -rwxr-xr-x  3 root root 61424 May  3  2005 /bin/gzip
> 
> $ ll /usr/bin/gzip
> lrwxrwxrwx  1 root root    14 Oct 18 10:27 /usr/bin/gzip -> ../../bin/gzip
> 
> $ ll /bin/gunzip
> -rwxr-xr-x  3 root root 61424 May  3  2005 /bin/gunzip
> 
> $ ll /usr/bin/gunzip
> lrwxrwxrwx  1 root root    16 Oct 18 10:26 /usr/bin/gunzip -> ../../bin/gunzip
> 
> I can't recall a method for telling apart standalone or hard linked files.

$ cd /bin
$ ls -li zcat gzip gunzip
159710 -rwxr-xr-x  3 root root 63216 May  3  2005 gunzip
159710 -rwxr-xr-x  3 root root 63216 May  3  2005 gzip
159710 -rwxr-xr-x  3 root root 63216 May  3  2005 zcat
^
|
This is the inode number. The fact that it's the same for all three
"files" means that all three directory entries (gunzip, gzip and zcat)
point ("link") to the same on-disk inode, containing the same data (and,
by extension, the same contents of the file).

(An inode contains data about the file: see 
http://en.wikipedia.org/wiki/Inode for details).

Note that for "normal" files, you'll still see an inode number: the way
"normal" files are stored in disk is a single directory entry linking to
an inode. Creating a "hard link" simply means creating more than one
directory entry linking to an inode.

In the above output and the "ll" output you listed above, the "1" after
the "lrwxrwxrwx" means that the directory entry only has one link (and
that's it). The "3" after the "-rwxr-xr-x" for the file means there are
three hard links to the file (and you're looking at one of them).

This is all standard Unix.

Hope this helps,

James.

-- 
E-mail address: james | "Today Has Been Two Of Those Days."
@westexe.demon.co.uk  |     -- Mike Andrews




More information about the fedora-list mailing list