Category Archives: rsync

rsync – Quick Reference

rsync is great to keep two folders or machines in sync, either locally or remotely. However, there are loads of command line options that can look complex for the initial user.

I have used the following command to sync one folder to another –

Notice that when you specify the source you must have a trailing ‘/’ to indicate the source directory. The destination is then specified by the directory you want to sync the files into.

By default rsync will not delete any files in the destination that it does not find in the source.

In the example above –

a – archive, this will sync folders recursively and deals with symbolic links and other special files. It also preserves dates, times, owners etc.
n – dry run – just show on the screen what will be done. Nothing is actually moved, created/deleted.
v – verbose, additional output onscreen.
P – Progress & Partial, shows progress of transfers and also allows restart after partial sync.

You may have noticed in the above example that both folders are in /mnt/…… I am using a Centos server to sync some folders from a HDA NAS system back to a Windows Home Server. Both systems are presenting shared drives that the Centos server has mounted and is then scanning in order to complete the rsync. The windows files shares are mounted using mount.

When entering the above commands you will be prompted for the password of the user supplied in order to access the fileshare.