Thursday, July 17, 2008

rsyn facts!!

What is Rsync?rsync is a file transfer program for Unix systems. rsync uses the “rsync algorithm” which provides a very fast method for bringing remote files into sync. It does this by sending just the differences in the files across the link, without requiring that both sets of files are present at one of the ends of the link beforehand. Some features of rsync include

If you don’t already have it installed, get it done this way on Debian systems:

apt-get install rsync

On other Linux distributions you would use yum(Fedora/CentOS) or yast (SuSE) to install rsync.

The base requirement of the rsync system is that you install the rsync program on the source and destination hosts. The easiest way to transfer files is to use a remote shell account. To copy a group of files to your home directory on host, you can run this command:

rsync file1 file2 … host:

Rsync defaults to rsh as the remote shell and that is not secure. Instead you can have rsync use ssh by using the option –rsh or -e ssh option:

rsync -e ssh file1 file2 … host:destination_dir

Copying one folder to another:

rsync -r /home/lxpages/junk /home/backups/junk/

That will copy the folder with simple application, without that much are to preservation of permissions/owners/etc. To make exactduplicates, we can add the -a switch.

Rsync everything from remote server and folder /home/lxpages/junk to local server and folder /home/lxpages/junk.

There are many more examples which I will include later parts. For now just remember that man page is your friend. Simply type ‘man rsync’ and read/view all the available options you can play around with.