rsync Backups and Directory Renaming, a Solution
Most rsync users will eventually confront this shortcoming. When renaming a directory tree on the sending side, rsync will copy the whole tree, then delete the old one on the receiving side.
Here is what my reasearch has given:
- « Your best bet is simply put up with it. Sorry. »
- This interesting solution involves hidden metadata files and bash scripts. I would look into this if I were renaming large directories often.
- This discussion brings up even more complex ideas and pointers to patches for rsync support for renamed directories. tl;dr.
Now, suppose you want to perform a backup which includes such a renamed directory and this problem is unlikely to be recurring, thus does not justify much research and development. Here is what I propose:
cp -lainstead of
- Add the
-H) switch to your recurring rsync job;
- Wait for
tail -F /var/log/crond.log | grep backup;
- Repeat #2 and #3.
There. Nothing of value was wasted.
Please do email comments. Contact info below.