wiki:full-filesystem-rsync

Version 1 (modified by Jamie McClelland, 8 years ago) (diff)

--

Full Filesystem rsync

Sometimes we need to move an entire server from one machine to another machine.

The first step is to boot the target guest from a debirf image, mount all filesystem in /mnt, and add the source server's ssh key into /root/.ssh/authorized_keys on the debirf image.

Then, on the source, edit and run the following script:

target=root@leslie.new:/mnt/

# -a typically means: --recursive --links --perms --times --group --owner
# --devices --specials
# we don't use extended attributes normally (otheriwse, we might want -X)
# or ACLs (otherwise might consider -A)

exclude="--exclude /etc/fstab --exlude /etc/network/interfaces /etc/udev/rules.d/*"
rsync -ax --hard-links --delete $exclude / "$target"
rsync -ax --hard-links --delete /srv "$target"
rsync -ax --hard-links --delete /var "$target"