Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My question begins with: Do I actually have hard links on my disk at all (except for "." and ".." of course)? I'm not sure how I would find that out?

If no, the question is already answered.

If yes, I'd like to adjust my backup routine (currently using rsync -a) to preserve my hard links. I've seen the option -H, but the man page worries me with a few statements, e.g.:

-a, --archive
    Note that  -a  does not preserve hardlinks, because finding 
    multiply-linked files is expensive...

-H, --hard-links 
    It does NOT currently endeavor to break already existing hard links 
    on the destination that do not exist between the source files. ...

    Note that rsync can only detect hard links between files that are 
    inside the transfer set...

So what should I do, if I have hard links on my disk?

share|improve this question
up vote 2 down vote accepted

If you have a standard distribution you will have few hard links , so you generally don't need to worry too much. /bin, sbin, /lib/modules, and /usr have a bunch of hard links so if you are backing them up you may want to use the -H option. Backup directories may also contain hard links. Otherwise, you shouldn't have hard links unless you create them yourself.

To find directories with hard linked files try the command (substitute / with other mount points if needed):

sudo find / -xdev ! -links 1 ! -type d | xargs -n 1 dirname | sort -u
share|improve this answer
Thanks! All sudo find / -xdev ! -links 1 ! -type d found for me are hard links between some cups files: /usr/lib/cups/backend/lpd - /usr/lib/cups/backend-available/lpd. Should I expect negative side effects, if they aren't restored correctly after a backup restore? (I just realized, that I already did a backup restore some time ago, which is maybe the reason why I don't have more hard links...) – Chris Lercher Jul 10 '11 at 14:54
You shouldn't expect negative side effects other than increased disk usage. The links should be replaced if you reinstall the related packages. This might happen if you patch something. New /lib/modules directories get created when a new kernel patch is installed. cups uses a hardlink, where most applications would use a symbolic link. This is a rare occurance. – BillThor Jul 10 '11 at 15:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.