add another hard disk on Fedora Linux

Paul Howarth paul at city-fan.org
Fri Nov 18 10:39:09 UTC 2005


Tim wrote:
> Tim:
> 
>>>Does anything use hard links?  I've cloned a drive using the cp command
>>>(with appropriate parameter), and not noticed any problems.
> 
> 
> James Wilkinson:
> 
>>Something like 
>>find / -noleaf -type f -links +2 -ls 2>/dev/null
>>will give you an answer for you system, but in general:
>>
>>Stuff like zcat, gunzip, and gzip are the same binary hardlinked under
>>the same name. It uses (either switches or) the command name to work out
>>what it's supposed to do.
> 
> 
> 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.

Use the "-i" option of "ls" to list their inode numbers. Same inode on 
the filesystem = same file.

$ ls -li /bin/*zip
79882 -rwxr-xr-x  3 root root 61424 May  3  2005 /bin/gunzip
79882 -rwxr-xr-x  3 root root 61424 May  3  2005 /bin/gzip

Hence these two are hardlinked together.

> Would file linking stuff-ups *might* get fixed the next time I update
> the packages that provides them?

Probably.

Paul.




More information about the users mailing list