« Sudoku Solving Program : Translating Python to JavaScript | Main | Linus on Source Code Management (SCM) »

Backing up PC data to a Linux box with rsync

Few days ago I figured out a simple, inexpensive and elegant solution to my backup needs and am thinking this may be of interest to others as well. Though keep in mind that this solution is somewhat specific to my setup and your mileage may vary.

I use a compaq nc4000 laptop running Windows XP as the main system and have a number of other machines running either WIndows or Linux. The main Windows XP system also includes Cygwin, a collection of GNU tools such as ssh, svn, cvs, tar, wget etc. Use of ssh keys allows ssh sessions to the Linux system without the need to enter a password. All my data files, including Outlook PST files, are under a single directory in C drive.

Copying a directory tree from Windows XP system to a Linux host machine is fairly straight-forward with rsync (available within Cygwin):

rsync -avz <datadir> <user>@<host>:backup
Running this command for the first time takes some time (proportional to the size of the data directory), but subsequent runs are pretty fast as it transfers only new or modified files.

Turning this simple command into a daily backup is fairly straight forward: create a command file backup.cmd with following text (or adapt to your setup):

c:
cd \
rsync -avz <datadir> <user>@<host>:backup >> backup.log
and setup a Windows Scheduled task by clicking on All Programs --> Accessories --> System Tools --> Scheduled Tasks. Besides specifying the task schedule, you would need to specify the exact pathname of the backup.cmd file.

That is all you need to do. Just look at c:\backup.log once in a while to make sure that the new or modified files are indeed being transfered.

No backup process is complete without the restore capability. So, here is the restore equivalent:

rsync -avz  <user>@<host>:backup/<datadir> .
Simple, inexpensive and elegant, isn't it!

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About

This page contains a single entry from the blog posted on April 20, 2007 4:15 PM.

The previous post in this blog was Sudoku Solving Program : Translating Python to JavaScript.

The next post in this blog is Linus on Source Code Management (SCM).

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33