detect file moves and renames with rsync
06 Aug 2014
I use rsync to backup my $HOME directory everyday with something like this:
$ sudo rsync -az --one-file-system --delete $HOME/ firstname.lastname@example.org:~/backup/$(hostname)
Most of the times it takes me less than 10 minutes at 2MB/s to re-sync everything, however last weekend it took almost 20 hours! so while I was waiting I decided to take a look to see what was happening. It turned out rsync was re-uploading some pretty heavy files because I had renamed them locally. I couldn’t believe rsync was so dumb, I was shocked O_O
So I went to Internet and looked for solutions, fortunatelly some other guys had found this problem before and created a couple of patches:
These patches add the following options:
- –detect-renamed, –detect-renamed-lax
Since I’m not the kind of person who enjoys spending their time compiling software I packaged a modified rsync version for supported Ubuntu LTS versions and upload it somewhere, while doing it I updated the patches to make them compile with the latest rsync version (at the moment of writing this version 3.1.1).
$ sudo apt-add-repository ppa:minos-archive/main $ sudo apt-get update && sudo apt-get install rsync
In my personal tests the modified rsync shows an amazing speed up for uploads who involve renamed/moved files, so I’m installing this in all my computers.
Note: For this to work, both, server and client must have installed the modified rsync version
Happy uploading 😋