Using RSync to backup from Windows to Linux

I have a laptop running Windows Vista and a PC running Ubuntu Linux. When I take photos I generally transfer them to my laptop initially, but I wanted a simple way of keeping a copy of all the photos on the linux box too as a backup. Linux boxes have a great tool for data synchronisation called rsync. rsync is a very powerful tool that can copy across only files that have been modified, and is even clever enough only to copy the differences between the files rather than the whole file. It can also compress the file before transferring it and decompress it at the other end seamlessly to improve network performance.

To use rsync to backup from the windows laptop however, I first needed to find a windows rsync server application. Luckily there is a very nice free application called DeltaCopy , which is bascically the linux rsync with a windows wrapper around it (using cygwin). I found it was easy to install and runs as a service in Windows. You can get DeltaCopy from here: http://www.aboutmyip.com/AboutMyXApp/DeltaCopy.jsp

Most versions of linux come with rsync included by default, so the linux end was easy to set up. I created a small script to run the actual synchronisation, and added it to cron so that it runs every hour and checks for new Photos on the laptop. You can see the script below:

 #!/bin/bash
 if [ ! -f "/tmp/synchronising" ]
 then
   echo "Running" > /tmp/synchronising
   rsync --verbose --progress --stats --compress --recursive --times 192.168.10.101::Photos /home/adam/Photos > /home/adam/Scripts/synchronisation.log
   rm -f /tmp/synchronising
 fi

Another good article on how to use rsync can be found here: http://everythinglinux.org/rsync/

Leave a Reply