Rsync

From AdminWiki

(Difference between revisions)
Jump to: navigation, search
(Synchronize a directory)
m (Synchronize a directory)
Line 6: Line 6:
===Synchronize a directory===
===Synchronize a directory===
-
   rsync -av -e [[ssh]] <directory to sync> <username>@<remote host>:<remote directory>
+
   rsync -av -e --delete [[ssh]] <directory to sync> <username>@<remote host>:<remote directory>
===Migrating a server===
===Migrating a server===

Revision as of 15:39, 1 June 2006

Contents

rsync

rsync is the perfect tool when you need to synchronize two files or file trees, be it just your homedirectory or a whole server. It's basic operation is like scp or rcp, but it has many more options which aim to keep traffic low if the amount of identical files on sender and receiver is high.

cookbook

Synchronize a directory

 rsync -av -e --delete ssh <directory to sync> <username>@<remote host>:<remote directory>

Migrating a server

To migrate a server,

rsync -avH -P --numeric-ids -x --delete / <additional mountpoints> <target>

usually does the trick. This should result in an exact copy of the source tree and gives you fancy progress bars while you wait for the rsync run to finish ;).

Minimum working config

log file = /var/log/rsyncd.log
use chroot = yes

[modulename]
path = /path/to/module
read only = yes
list = yes
transfer logging = yes 
Personal tools