Backing up your files with rsync

rsync makes the task a lot easier as it only downloads files that have changed - saving time and bandwidth.

Setup ssh keys so that you don’t need to enter a password each time you attempt to rsync folders.

On the destination server, the command is as follows:

rsync -e ’ssh -p 2222′ -avl –delete –stats –progress root@192.168.1.1:/home/buddy /backup/

-e ’ssh -p 2222′: this ensures rsync uses the SSH protocol and sets the port.

-avl: This contains three options;

(a) is archive mode which basically keep the permission settings for the files.
(v) is verbose mode. You can leave it out or increase it by appending two v’s (-vv).
(l) preserves any links you may have created.

–delete: deletes files from the destination folder that are no longer required (i.e. they have been deleted from the folder being backed up).

–stats: Adds a little more output regarding the file transfer status.

–progress: shows the progress of each file transfer. Can be useful to know if you have large files being backup up.

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.