According to the rsync man page:
-a, --archive This is equivalent to -rlptgoD. It is a quick way of saying you want recursion and want to preserve almost everything (with -H being a notable omission). The only exception to the above equivalence is when --files-from is specified, in which case -r is not implied.
Note that -a does not preserve hardlinks, because finding multiply-linked files is expensive. You must separately specify -H.
It seems that we must use the -H
option in order to copy also hard links (really?).
But according to my tests even if I don't use the -H
option, rsync copied the hard link successfully from the local directory to another machine. This seems strange to me.
For example
$ ls -ltr
-rw-r--r-- 1 root root 0 Jan 20 15:06 test.file.hard.link
-rw-r--r-- 1 root root 0 Jan 20 15:06 test.file
$ rsync -Wav --progress /var/tmp/Backup_test_for_hard_link node1:/var/tmp
In node1 under /var/tmp
, I see the hard link files:
-rw-r--r-- 1 root root 0 Jan 20 15:06 test.file.hard.link
-rw-r--r-- 1 root root 0 Jan 20 15:06 test.file
How can this be explained?