Pick a Free OS

User login

Navigation

Using Rsync

This article is basically written for Rsync, a very fast, flexible and robust backup utility. We will look at how you can utilize and configure this program to take the daily backup from your production servers.

What is Rsync?

Rsync is a program, which is used for taking the backups on regular basis. However it can also be configured to upload large portals and any other data on the remote servers. It is very similar to rcp but with many more features. It is based on remote-update protocols, which means that it only sees the differences between the source and destination files and if the files has been changed, takes the backup otherwise leaves it without taking any backup. This difference may be the time stamp difference i.e. the date when it was modified or created is changed. By virtue of which it speeds up the file transfers even if it is of several gigabytes.

It can be used to copy files from remote machines to local machines and vice versa in which one of the machine must be local. It can also be utilized to take the backup locally to different partitions.

Command to check if Rsync is installed on the machine


# rpm -q Rsync


# rsync-2.4.1-2

It means that the Rsync installed on the machine is version 2.4.1-2. If it doesn't display and says not installed then you first have to install Rsync on the server side. Once installed you can use Rsync to any machine that you can use rsh to. Rsync uses rsh for its communications, unless both the source and destination are local.

To install Rsync give the command


#rpm -Uvh rsync-2.4.1-2.i386.rpm

In order to run an Rsync program you must have to run Rsync daemon at the server. This is accomplished either running the command


#rsync --daemon


or you can edit two files if you want rsyncd daemon to run when system boots.


1. Append the following text in /etc/services

file, if not already there:

rsync 873/tcp


2. Make an entry in /etc/inetd.conf by putting the line

rsync stream tcp nowait root /usr/bin/rsync rsyncd --daemon

Replace the "/usr/bin/rsync" with the path where you have installed the rsync. Its a good idea to run the rsync daemon during the boot time when you have to use rsync very often. During the boot time it initiates the rsyncd daemon through the super server i.e inetd.

Rsync configuration files

There are three configuration files to run rsync server viz.


1. /etc/rsyncd.conf,


2. /etc/rsyncd.pid


3. /etc/rsyncd.secrets