= Full Filesystem rsync = See [wiki:bdsync bdsync] for an experimental alternative to this approach. 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 [wiki:debirf-boot-on-kvm-guest debirf image], mount all filesystem in /mnt, install rsync and openssh-server, 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: {{{ # make sure all the remote filesystems are properly mounted under /mnt target=root@leslie.new:/mnt target_host=root@leslie.new # all user/system non-temporary filesystems on the origin server: originfilesystems="srv var home" # -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 --exclude /etc/network/interfaces --exclude /etc/udev/rules.d" rsync -ax --hard-links --delete ${exclude} / "${target}"/ for fs in ${originfilesystems}; do echo "transfering filesystem from /${fs}" rsync -ax --hard-links --delete /${fs}/ "${target}/${fs}/" done }}} Assuming your target is an MFPL kvm guest, you will want grub to output to a serial console and you will want a login prompt on the serial console. Therefore, you may want to add these lines to your script: {{{ ssh "$target_host" "sed -i 's|^#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100|T0:23:respawn:/sbin/getty -L ttyS0 115200 vt102|' /mnt/etc/inittab" ssh "$target_host" "sed -i 's|^1:2345:respawn:/sbin/getty|#1:2345:respawn:/sbin/getty|' /mnt/etc/inittab" ssh "$target_host" "sed -i 's|^2:23:respawn:/sbin/getty|#2:23:respawn:/sbin/getty|' /mnt/etc/inittab" ssh "$target_host" "sed -i 's|^3:23:respawn:/sbin/getty|#3:23:respawn:/sbin/getty|' /mnt/etc/inittab" ssh "$target_host" "sed -i 's|^4:23:respawn:/sbin/getty|#4:23:respawn:/sbin/getty|' /mnt/etc/inittab" ssh "$target_host" "sed -i 's|^5:23:respawn:/sbin/getty|#5:23:respawn:/sbin/getty|' /mnt/etc/inittab" ssh "$target_host" "sed -i 's|^6:23:respawn:/sbin/getty|#6:23:respawn:/sbin/getty|' /mnt/etc/inittab" ssh "$target_host" 'echo nameserver 209.234.253.239 > /mnt/etc/resolv.conf' ssh "$target_host" 'echo GRUB_CMDLINE_LINUX=\"console=ttyS0,115200n8\" >> /mnt/etc/default/grub' ssh "$target_host" 'echo GRUB_TERMINAL=serial >> /mnt/etc/default/grub' ssh "$target_host" 'echo GRUB_SERIAL_COMMAND=\"serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\" >> /mnt/etc/default/grub' ssh "$target_host" "chroot /mnt update-grub" }}}