Thursday, June 4, 2009

Rsync backup - a quick HowTo

This is a quick HowTo for taking backup using rsync utility.
Rsync utility is an open sourec tool used for incremental backup.

Man page of rsync describes all options for rsync utility.

Here we show you some simple command for incremental backup using rsync.

For example we have two Linux servers server1 and server2 and we want to take
incremental backup of server1 "/data" directory to server2 "/backup/data".
In order to do this rsync utility must be installed in both of the servers.

Steps:

1. login to server2 and create the backup directory /backup/data (Tag - Rsync backup)
2. now run the following command from server2  (Tag - Rsync backup)
rsync -avz -e ssh user@server1:/data/ /backup/data/  ( this will fetch files fromm server1 and store it to local(server2) /backup/data)    (Tag - Rsync backup)
3. This will prompt for user password (ssh) - server1    (Tag - Rsync backup)
5. After providing password for user rsync will start syncing files.
6. Once this is done , you can see all files under /data in server1 are also in /backup/data/ in server2              (Tag - Rsync backup)
7. Now to schedule this backup process , you can use cron .   (Tag - Rsync backup)

If you don't want to provide password each time , you can setup password less ssh 
between these two servers.   (Tag - Rsync backup)

No comments: