rdiff-backup on Windows

rdiff-backup is a very handy utility to effectively create and manage incremental file backups. Most modern GNU/Linux distributions offer rdiff-backup as installable package. Sadly there is no easy to install version available for Windows.
So, here is a short guide:
If you have Cygwin installed, you’re almost ready to go. Make sure to install the following packages with the Cygwin installer:

Devel/
autoconf
automake
binutils
gcc
make
patchutils
Interpreters/
python
Web/
wget

Next step is to open the Cygwin console. We have to download librsync because it is a prerequisite for rdiff-backup. To do so, type the following:

# wget http://mesh.dl.sourceforge.net/sourceforge/librsync/librsync-0.9.7.tar.gz

Now we need to unpack the archive and build it:

# tar xzf librsync-0.9.7.tar.gz
# cd librsync-0.9.7
# ./configure --prefix=/usr --bindir=/bin --libdir=/lib
# make all
# make install

Next step is to download rdiff-backup:

# cd ..
# wget http://savannah.nongnu.org/download/rdiff-backup/rdiff-backup-1.1.5.tar.gz

Now unpack the archive:

# tar xzf rdiff-backup-1.1.5.tar.gz
# cd rdiff-backup-1.1.5

I had a problem with version 1.1.0-1.1.5 where rdiff-backup would stop with a stack trace and an uncaught exception while finishing the backup. In this process it’s calling fsync, which is unsupported on Windows. Thus, we need to apply a quick and dirty patch to the file rpath.py before continuing.

# cd rdiff_backup
# wget http://www.katastrophos.net/downloads/rpath-fsync.patch
# patch < rpath-fsync.patch
# cd ..

Type this to install rdiff-backup:

# python setup.py install

If the installation was successful, you can safely delete the directories and files downloaded:

# cd ..
# rm rdiff-backup-1.1.5.tar.gz librsync-0.9.7.tar.gz
# rm -Rf rdiff-backup-1.1.5 librsync-0.9.7

More information on how to use rdiff-backup can be found here.

Update 1 (January 24th, 2006): Updated to version 1.1.5.

19 Responses to “rdiff-backup on Windows”


  1. 1 davekempe

    I have an installer for rdiff-backup on windows here:
    http://solutionsfirst.com.au/~dave/backup/
    it does not include this patch, but I hope to update the package to 1.0.5 and include your patch with a warning in the readme. I suppose ideally, fsync by python cygwin would be supported in a win32 fashion, but its not going to happen. Anyway, check out my package if you want an easy way to get it up and running.

    thanks

    dave

  2. 2 Andre

    Hey Dave!
    Thanks for the hint. I’ll check it out.
    As for the fsync patch. It’s really just a dirty workaround and could probably be handled in a more elegant fashion.

    Regards,
    Andre

  3. 3 Dmitry Vereschaka

    Dave,
    Thank you for your windows version of rdiff-backup!
    But there are several problems:
    1. .bat files are hardcoded to use c:\rdiff-backup folder. When installing into other folder, they are not working.
    2. you should save your filelists used in –exclude-filelist –exclude-globbing-filelist and so on in unix format (LF), not windows format (CRLF), otherwise rdiff-backup will not find any file or directory since they aren’t ended with CR.

    Do you plan to support windwows version of this tool? current version is 1.04, yours - 1.01.

  4. 4 Ben

    I followed the top-most post, nice work. Any idea why I would get the following:

    Tue Apr 18 23:11:36 2006 Fatal Error: Time of Last backup is not in the past.
    This is probably caused by running two backups in less than a second. Wait a second a try again.

    This happens if I re-run rdiff-backup after the initial run.

    $ date
    Tue Apr 18 23:20:34 EDT 2006
    $ /usr/bin/rdiff-backup c:/temp/test c:/temp/test2

    $ /usr/bin/rdiff-backup c:/temp/test c:/temp/test2
    Fatal Error: Time of Last backup is not in the past. This is probably caused
    by running two backups in less than a second. Wait a second a try again.

    $ date
    Tue Apr 18 23:21:06 EDT 2006

    $ /usr/bin/rdiff-backup c:/temp/test c:/temp/test2
    Fatal Error: Time of Last backup is not in the past. This is probably caused
    by running two backups in less than a second. Wait a second a try again.

  5. 5 Ryan

    The step “./configure –prefix=/usr –bindir=/bin –libdir=/lib” dies with “bash: ./configure: /bin/sh: bad interpreter: No such file or directory”.

    Mind boggling that cygwin does not ship with a working /bin/sh/. Worse still, I can’t find sh.exe ANYWHERE in the packages listed in setup.exe — not under “Shells,” not under “Devel,” not under “Base”, “Interpreters” — it’s not anywhere.

    This is infuriating. Cygwin - aghhhh!

  6. 6 Ryan

    Reinstalling ash, coreutils and some other randomly selected things seems to have fixed sh.exe issue.

  7. 7 Ryan

    Note: Unix files with illegal windows chars — the asterisk in my case (”*”) — will choke rdiff-backup and derail your whole backup.

  8. 8 Morgan

    Hi
    Does the patch work for 1.1.10? Or, is it specific to 1.1.5?
    Thanks

  9. 9 chencho

    Hi all!

    I want to update with 1.1.5 rdiff-backup your app, but i have some problems.

    I have not idea how to make rdiff-backup “standalone”, without cygwin installation; i made your installation, then setup cygwin and compile rdiff-backup and finally replace all of the files that appers twice in your install and in cygwin. In this way i have a problem with cygwin1.dll :(

    Can you show as how to make rdiff-backup standalone without cygwin??

    Thanks.

  10. 10 Todd

    PERFECT! FYI - in version 1.0.5 of rdiff-backup line 1075 of rpath.py has the line which needs to be commented out…

    $ diff rpath.py rpath.py.orig
    1075c1075
    os.fsync(fd)

    Thanks for posting this info.

  11. 11 Carl Stephenson

    Thanks for writing this tutorial! I don’t think that I could have gotten rdiff-backup on Windows working without your help!!

  12. 12 Andrew Ferguson

    This patch is no longer necessary starting with version 1.1.8 of rdiff-backup.

    Also, version 1.1.12 incorporates a number of improvements for those running on Cygwin. It now compiles and runs ‘out of the box’.

  13. 13 Sriram M

    Thanks Dave. I sucessfully installed the rdiffbackup 1.0.1 from http://solutionsfirst.com.au/~dave/backup/ folder and it works gr8.

    However I need a favour. Do you have any installer (for windows) for the version 1.0.5?

    Any help is appreciated.

  14. 14 Mico

    I tried to build rdiff-backup under Windows XP using MinGW. Compilation process seemed OK but when I try to use rdiff-backup, for example: python rdiff-backup then appear error message: no module named grp, pwd. I thought because in user_group.py there is a line stating import grp, pwd. I tried rdiff-backup version 1.1.16 (newest).

  15. 15 Luís Miranda

    This is now available in the Cygwin installer.

  1. 1 Duplicity at Katastrophos.net Blog
  2. 2 duplicity 0.4.2 on Cygwin at Katastrophos.net Blog
    Pingback on Apr 3rd, 2006 at 1:07
  3. 3 The Highlights » Windows and Mac backups using rdiff-backup
  4. 4 Ideensammlung. » Blog Archive » Rdiff-backup 1.1.5 mit Windows XP und cygwin nutzen

Leave a Reply