From time to time, I have to perform several large migration changes on data files on my server, and I'm looking for a good way to do this. I was thinking about using rsync to duplicate my directory structure starting at the root data folder, creating hard links to all original the files (some of them are rather big), and I can overwrite in the destination tree only the files that need migrating. In the end, I can safely switch from the old files to the new files with two
However, I can't seem to get rsync to do this. I tried
rsync -a --link-dest=$DATA $DATA $DATA/../upgrade_tmp
but instead of creating hard links to files, rsync copies them entirely. Is there a problem using the same source and link-dest directory?