Rsync apparently breaks hard links

hardlinkrsync

On the source server (A), I got a file
/opt/resources/xxx
and a hard link
/etc/apache2/sites-available/xxx pointing to this file.

On another server (B) I got the same structure
/etc/apache2/sites-available/xxx hard linked to /opt/resources/xxx

I rsync on server (A) towards server (B) all changes under /opt

When I change file xxx on server A, and then rsync to server B
these changes are reflected. /opt/resources/xxx on server B contains my changes I made on the same file on server A.

The only thing I don't understand is that the file /etc/apache2/sites-available/xxx
doesn't contain the change.

It appears as if rsync breaks the hard link, but probably I'm missing some configuration option.

Which one ?

Francis

Best Answer

-H is the option for preserving hard links; it is not included in -a.