Linux / Unix Tips and Tricks

This blog contains Linux / Unix Tips and Tricks, collected during my work as a Unix System Administrator.
They are here for my own reference, but they might help you as well !

Using rsync to synchronize a filesystem

len | 27 May, 2009 09:16

Here's the command that I use to synchronize a filesystem from one server to another: 
rsync -avx --numeric-ids --progress --delete 10.0.0.1:/mnt/sda1/ /mnt/sda1/
The -a option sets “archive mode”, which essentially turns on a number of rsync options 
that preserve file ownership and permissions and other settings. 
The -v option makes rsync provide more output about what it is doing, 
and the --progress argument displays a progress meter so you can keep up with how long rsync will take. 
The other two arguments are rather important, and if you don't
use rsync regularly, you might not come across them much. The -x argument
tells rsync to stick to one filesystem. This is important particularly
when you back up the / partition; otherwise, rsync happily will traverse
into /home or any other partitions you have and copy them all into your
local /mnt/sda1 mountpoint, which probably will not have enough space
to hold everything. The --numeric-ids argument sets file permissions
on the destination files based on their numeric ID and not the matching
user or group name. 
 
 
Accessible and Valid XHTML 1.0 Strict and CSS
Powered by LifeType - Design by BalearWeb