Rsync
From AdminWiki
(Difference between revisions)
(→cookbook) |
(→Minimum working config) |
||
(10 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
= [http://rsync.samba.org/ rsync] = | = [http://rsync.samba.org/ 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. | + | 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 == | == cookbook == | ||
+ | |||
+ | ===Synchronize a directory=== | ||
+ | |||
+ | rsync -av -e [[ssh]] --delete <directory to sync> <username>@<remote host>:<remote directory> | ||
===Migrating a server=== | ===Migrating a server=== | ||
Line 10: | Line 13: | ||
<pre> | <pre> | ||
- | rsync - | + | rsync -avH -P --numeric-ids -x --delete / <additional mountpoints> <target> |
</pre> | </pre> | ||
- | usually does the trick. This should result in an exact copy of the source tree. | + | 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 ;). |
+ | |||
+ | The --numeric-ids is necessary because you otherwise end up having garbled usernames when the source and destination OS use different username <-> userid mappings. | ||
- | ===Minimum working config=== | + | ===Minimum working daemon config=== |
<pre> | <pre> | ||
log file = /var/log/rsyncd.log | log file = /var/log/rsyncd.log | ||
- | |||
use chroot = yes | use chroot = yes | ||
- | [ | + | [modulename] |
- | path = /path/to/ | + | path = /path/to/module |
read only = yes | read only = yes | ||
list = yes | list = yes | ||
transfer logging = yes | transfer logging = yes | ||
</pre> | </pre> |
Latest revision as of 17:02, 27 September 2007
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 ssh --delete <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 ;).
The --numeric-ids is necessary because you otherwise end up having garbled usernames when the source and destination OS use different username <-> userid mappings.
Minimum working daemon config
log file = /var/log/rsyncd.log use chroot = yes [modulename] path = /path/to/module read only = yes list = yes transfer logging = yes