Saturday, February 02, 2008

Rsync Example


Using rsync to execute an initial copy of data from the SOURCE to TARGET machine via a SSH transport:

rsync -avx --numeric-ids --progress -e ssh /data/ root@<TARGET_IP_ADDRESS>:/data

Using rsync to maintain synchronization after the initial copy:

rsync -avx --numeric-ids --progress --delete -e ssh /data/ root@<TARGET_IP_ADDRESS>:/data

-- The "--delete" option has been added to delete files from the TARGET that have been deleted from the SOURCE since the initial rsync.

-- The "--dry-run" or "-n" option can be added to reveal what rsync intends to do.

-- The trailing "/" on the SOURCE directory is intentionally there and keeps that directory from being created under the TARGET subdirectory.