| 1 | = Full Filesystem rsync = |
| 2 | |
| 3 | Sometimes we need to move an entire server from one machine to another machine. |
| 4 | |
| 5 | 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. |
| 6 | |
| 7 | Then, on the source, edit and run the following script: |
| 8 | |
| 9 | {{{ |
| 10 | target=root@leslie.new:/mnt/ |
| 11 | |
| 12 | # -a typically means: --recursive --links --perms --times --group --owner |
| 13 | # --devices --specials |
| 14 | # we don't use extended attributes normally (otheriwse, we might want -X) |
| 15 | # or ACLs (otherwise might consider -A) |
| 16 | |
| 17 | exclude="--exclude /etc/fstab --exlude /etc/network/interfaces /etc/udev/rules.d/*" |
| 18 | rsync -ax --hard-links --delete $exclude / "$target" |
| 19 | rsync -ax --hard-links --delete /srv "$target" |
| 20 | rsync -ax --hard-links --delete /var "$target" |
| 21 | }}} |