Sunday, January 22, 2012

How to backup the file and directory using rsync?

  Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon.

Some Examples of rsync :

1.Synchronize Two Directories in a Local Server :

root@mughil:rsync -zvr /source-dir /destination

2.Synchronize Files From Local to Remote

root@mughil:rsync -avz /source username@

3.Remote shell for Synchronization

root@mughil:rsync -avz -e ssh username@ /destination

4.Exclude and include in the synchronization

root@mughil:rsync -avz --include 'a*' --exclude '*' username@ /destination

Frequently Used Option in rsync :

-a is archive mode
-d to synchronize only directory tree
-z is to enable compression
-v verbose
-r indicates recursive