aoline.com simple non technical information

Easy rsync backups to your Windows XP machine

This article follows on from Part 1 Secure rsync server backups to help you backup remote computers to your local Windows XP machine for easy exact syncronisation and DVD backups.

Using rsync to make secure efficient backups is a little tricky so here is my easy step by step guide.

1. Setting up rsync on windows XP

Log into your Windows XP machine as an administrator and download the Cygwin application from http://www.cygwin.com/

Accept the defaults and choose a remote server until you reach the screen to choose the individual packages you want to install. rsync is not installed by default so you need to select these packages:

In the Net category select:

rsync
openssh

Then continue. If you need to go back and change your package installations later you can just re-run the Cygwin setup program. The defaults are remembered.

Once Cygwin is installed run the application from your Windows Explorer or desktop shortcut. This will bring up a command prompt like shell. Type rsync --version to check rsync is installed.

2. Password-less logins

For password-less login to your remote server run you need to exchange keys. Enter this at the Cygwin prompt:

ssh-keygen -t rsa

and follow the defaults with no password. This creates a key on your local machine to allow password-less logins to the remote machine.

IMPORTANT - You now need to exchange the key you just created so read my earlier article Secure rsync server backups to get this part completed then return back here to test your connection and schedule this task.

3. Special configuration considerations

The root or / location in Cygwin is actually your default installation normally C:/cygwin so when you enter a path relative to / bear this in mind.

rsync won't let you back up to another drive so if you don't want to backup to your C:/ folder first create a shortcut to the folder of your choice on the other drive. I used this command:

ln -s G:/backup-data/foldername shortcutname

This creates a special shortcut called 'shortcutname' at the location C:/cygwin/shortcutname but if you try to browse it shows the contents of G:/backup-data/foldername so you can reference this new folder in your rsync command with /shortcutname

Test your rsync connection as follows:

rsync --dry-run --verbose --progress --stats -- compress -- recursive --times --perms --links login@remoteserver.com:folder/* /shortcutname

This command won't mess anything up with the --dry-run to check all is working fine. When you are happy run this command again without the --dry-run

4. Creating a batch file

Now you are up and running it is cool to automate this so create a new text file with the following and save as C:/cygwin/backup.bat

@echo off
@echo Backup started!
@echo Started synchronizing at %TIME%
@echo This close automatically when finished...
C:\cygwin\bin\rsync.exe --rsh="/bin/ssh" --verbose --progress --stats --compress --recursive --times --perms --links login@remoteserver.com:folder/* /shortcutname > C:\cygwin\rsync.log

These lines are a tiny bit different from your test command but should cause you no problems. Use the --delete option if you want to delete files from your remote location that you may delete locally.

You can run this command when you like and you'll get progress. You can see that the messages are output to the log file at C:/cygwin/rsync.log so check this for problems.

The final step is setting up a task. Browse your Start menu to Start > Programs > Accessories > System Tools > Scheduled Tasks and follow the steps in the wizard.

The first time you run a full backup it will take a long time but the second and subsequent times will be very much shorter and you know you always have an exact backup copy. Burn to DVD for off-site longer term storage as any server problems will get replicated as well!