|
RSync is a computer program which
synchronizes files and directories from one location to another while minimizing
data transfer using delta encoding when appropriate. An important feature of rsync not found in most similar programs/protocols is that the mirroring takes
place with only one transmission in each direction.
The bottom line is that it kicks ass for automated backups, either on the local
LAN or remotely over the internet. It does such a good job over remote
connections because it only sends the changes, not the changed files, but just
the changes to the files. Let's say you had a very large text file and all you
did was add a period to the very end of the file, only that one period character
is sent when you sync the backup.
Because of
this bandwidth saving design I use it for server backups of several hundred gig of
data. The web server only takes about a minute to sync its backup.
RSync can either push or pull the data, but I'll detail a scenario where there
is a central RSync server to receive the backup data with multiple clients
pushing their data backups. My following examples use the same PC for both the
server and client.
RSync Server Setup
On the eComStation or OS/2 machine that will act as the server I
have created a directory C:\backup
Download rsync from Paul Smedleys' site at
http://smedley.info/os2ports/rsync.html and extract the file "rsync.exe" to
the C:\backup directory
In that directory I created a file called "rsyncd.conf" containing
the text:
max connections = 6
timeout=600
lock file = /var/rsyncd.lock
log file = /var/rsyncd.log
pid file = /var/rsyncd.pid
[backup]
comment = backup storage area
path = /backup
read only = false
list = yes
gid = root
uid = root
Now we can start up the rsync daemon process.
Open a command prompt and change to the C:\backup directory and execute the
following command:
rsync --daemon --config="rsyncd.conf"
--no-detach
You'll want that in a batch file for regular use.
To test that the daemon is up and running properly open another command prompt,
change to the C:\backup directory and execute the command:
rsync localhost::
The response should look like this:
[C:\backup]rsync localhost::
backup
backup storage area
[C:\backup]
The server is ready to accept data.
Pushing the client
data to the RSync server
For my
example here I'll run a backup of my C:\HOME and C:\VAR directories and push the
data to the locally running rsync server by executing this command from the
c:\backup directory:
rsync -vru --delete /home /var
localhost::backup/ecs_workstation/
The -vru tells it that I want
-v = verbose output
-r = to copy directories
recursively -u = update
The
--delete tells it to remove files on the server end that have been deleted on
the client end.
Note that it does accept
multiple sources directories. (in unix style paths).
After running this, my C:\backup directory now contains the subdirectory "ecs_workstation"
with copies of my home and var directory.
Further runs of rsync will be far faster since it will only be updating changes.
^piggy^ |