From LQWiki
(Redirected from RSync)
Jump to: navigation, search

rsync allows you to synchronize two directories that can even be on different computers. All files in the target directory will be checked and, if needed, changed to have the same content as in the source directory.

Using rsync for secure remote backups

rsync can be used locally or over the network. It supports ssh, for secure remote differential backups.

General usage:

rsync -e ssh -avz [src_path][dst_path]


rsync -e ssh -avz /etc/

To delete files that are on the destination system but no longer on the source system, use the --delete option:


rsync -e ssh -avz --delete /lib/

Here's the full meal deal for doing a total system backup. This will completely duplicate one system onto another, over the Internet. Make sure the hardware, boot devices, etc are the same or you're in for trouble:

rsync -e ssh -avz --stats --progress --delete-after --exclude-from=/root/rsync-exclude /

Note that "/root/rsync-exclude" should include things like:


Comparing directories

You can use rsync to show differences between two directories without changing anything. In the following example, your /home/myuser is compared with the same folder on computer target:

rsync -e ssh -avz --delete --dry-run /home/myuser root@target:/home

This comparison only considers timestamps and file sizes. For comparing directories based on content, use other programs, e.g. krusader.