13

Imagine I have a file remote/A which syncs to local/A and local/B is a hardlink of local/A. Is there a threat that on a next remote/A change and synchronization rsync will not delete local/A but only replace/add some part to it, thus changing local/B (because of hardlinking)?

user619271
  • 232
  • 1
  • 6

1 Answers1

15

With standard options, rsync will copy the new file assigning it a semi-random name, then it will rename the new file with the original name. In this process, no writes are directed at the original file, preserving its hadlinks.

On the other side, using the non-default--inplace option will overwrite the original file and its hardlinks.

Anyway, I strongly suggest to give a look at --link-dest option, which is extremely useful for deduplicated backups.

shodanshok
  • 44,038
  • 6
  • 98
  • 162