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:

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:

  1. cp -la instead of mv;
  2. Add the --hard-links (or -H) switch to your recurring rsync job;
  3. Wait for tail -F /var/log/crond.log | grep backup;
  4. rm -rf
  5. Repeat #2 and #3.

There. Nothing of value was wasted.

Please do email comments. Contact info below.

Alexandre de Verteuil
Alexandre de Verteuil
Senior Solutions Architect

I teach people how to see the matrix metrics.
Monkeys and sunsets make me happy.

Related