5

I just noticed that there is a discrepancy between version 3.0.9 and 3.1.0 of rsync.

Running the command

$ rsync -a --delete --backup --backup-dir=../old source/ dest/

with version 3.1.0 gives the output

Created backup_dir ../old/

even when no files are copied to the backup directory. I usually add the current time to the backup directory name, which means I end up with many empty directories. With version 3.0.9 of rsync, a backup directory was only created if needed.

My questions are:

  1. Is this an intended behaviour, and if so, is it possible to suppress the creation of empty backup directories?
  2. Can I install version 3.0.9 of rsync alongside with version 3.1.0 such that one is called say rsync309 and the other one rsync310, and then have an alias linking rsync to either of the two (which in my case means that I would keep using rsync 3.0.9 as I found this new behaviour annoying)?
  • I have version 3.0.9 on my Debian server, and I also get these empty folders you describe. I scoured the man page to try and find a way to only have backup dirs created if they are necessary, but I've come up with nothing. I am also looking for a solution to this, aside from writing a script to search for and delete empty folders. – jlacroix82 Sep 7 '14 at 23:46
  • I do not have this problem with version 3.0.9, only 3.1.0. (I am using Ubuntu.) – DustByte Sep 8 '14 at 10:32
3

Yes, this was intended behavior. Bug no 11423 was filed about it, and it was changed back in version 3.1.2.

https://bugzilla.samba.org/show_bug.cgi?id=11423#c12 :

While I continue to like the new early verification of the top-level backup dir at the start of the transfer, I've been persuaded to have it go back to not creating the directory until it is needed. Fixed for upcoming 3.1.2 release.

While most distributions don't provide packages for version 3.1.2 yet, it is really quick and easy to compile: I did the following on Debian Jessie, and it went fine, installing the new version into /usr/local/bin:

wget https://download.samba.org/pub/rsync/src/rsync-3.1.2.tar.gz
tar xvf rsync-3.1.2.tar.gz -C /tmp/
cd /tmp/rsync-3.1.2/
./configure
make
make install

If you use it as a daemon, your init script may call it by it's full path, so you may also want to replace it with a link to the new version:

/etc/init.d/rsync stop
mv /usr/bin/rsync /usr/bin/rsync.old
ln -si ../local/bin/rsync /usr/bin/rsync
/etc/init.d/rsync start

Update: If you are on Debian Jessie, you can actually just install the rsync package from Debian Stretch :

wget "http://ftp.ch.debian.org/debian/pool/main/r/rsync/rsync_3.1.2-1_amd64.deb"
dpkg -i rsync_3.1.2-1_amd64.deb
  • Packaging rsync 3.1.2 for Debian using the existing packaging would be likely to work. It probably hasn't changed much across a minor release. – Faheem Mitha Mar 27 '16 at 13:50
  • Yes, a .deb package would be nice. Meanwhile, the above wget ... make install is much faster for me, even on half a dozen machines, than learning how to make a .deb package correctly. But I do hope that one will appear soon... – mivk Mar 31 '16 at 14:35
  • If you want a walkthrough on how to make a Debian package in this case, it's not hard. Of course, you'd have to update it manually for security releases. – Faheem Mitha Mar 31 '16 at 15:00
  • 1
    3.1.2, when no file are copied, tells a new dir is to be created when it doesn't exist (but doesn't create it). this is fixed in 3.1.3 – Ring Ø Aug 25 '18 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.