Hi! It's me again with another --link-dest issue:
I am using dirvish (www.dirvish.org) to create daily backup on disk images. dirvish is using rsync with --link-dest pointing to the last good image. This creates images with hardlinks to unmodified files. So far so good. Now I want to create a "current" filetree with hardlinks pointing to the last image. rsync -vaH --delete --stats --numeric-ids -x --link-dest=/path/to/lastimg /path/to/lastimg /path/to/current This works except when an existing file has been modified and is now "new" (and not the n'th hardlink) in the image. This file is copied to the "current" directory. A hardlink pointing to the file in lastimg is not created. If a new file has been created in between the dirvish runs it perfectly gets hardlinked in the "current" directory. Is that intented behaviour? You can easily reproduce the issue with the following commands: # create source dir mkdir -p /tmp/rsync/src # create 1st file echo 1 > src/a # create 1st "backup" image rsync -vaH --delete --numeric-ids -x /tmp/rsync/src/ /tmp/rsync/1/ # create "current" dir with hardlinks from 1st image rsync -vaH --delete --numeric-ids -x --link-dest=/tmp/rsync/1/ /tmp/rsync/1/ /tmp/rsync/current/ # create 2nd file echo 2 > src/b # create 2nd image rsync -vaH --delete --numeric-ids -x --link-dest=/tmp/rsync/1/ /tmp/rsync/src/ /tmp/rsync/2/ # create "current" with hardlinks from 2nd image rsync -vaH --delete --numeric-ids -x --link-dest=/tmp/rsync/2/ /tmp/rsync/2/ /tmp/rsync/current/ # modify 1st file echo 3 >> src/a # create 3rd image rsync -vaH --delete --numeric-ids -x --link-dest=/tmp/rsync/2/ /tmp/rsync/src/ /tmp/rsync/3/ # create "current" with hardlinks from 3rd image rsync -vaH --delete --numeric-ids -x --link-dest=/tmp/rsync/3/ /tmp/rsync/3/ /tmp/rsync/current/ The last call to rsync will not re-create the hardlinked file "a" but will create a new copy of "a" in the "current" directory. If "current" is removed and re-created: rm -rf current rsync -vaH --delete --numeric-ids -x --link-dest=/tmp/rsync/3/ /tmp/rsync/3/ /tmp/rsync/current/ both files "a" and "b" are hardlinks pointing to the 3rd image. Greetings -- Robert Sander -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html