How to migrate KVM based VPS to a different node or dedicated server

This tutorial will show you how to easily migrate from one KVM to another or to a dedicated system.

In this example I am migrating a KVM from France to Austria while keeping all data and without manual new installation/configuration, by using an image copy.

-------------

You need:

VNC/IPMI access on both ends.

Possibility to mount a GRML or Debian/Ubuntu Live CD

Same or larger HDD size on the target server.

-------------

First shutdown both servers, we will call the source server Server A and the target server Server B here:

Connect to VNC/IPMI and boot the GRML or Debian/Ubuntu Live CD on both, make sure GRML sees your HDD by using "fdisk -l". Note the path (ex. /dev/vda) on Server A of the HDD you want to migrate and the target path on Server B.

Make sure GRMLs SSH server is setup (service ssh start) on Server A and that you have a root password set (passwd).´

Now on Server B enter this command (replace first /dev/vda with source disk and second one with target disk):

 

ssh root@ServerA 'dd if=/dev/vda | gzip -f' | gzip -d | dd of=/dev/vda

 

After this process completes (limited by network speed and size of the HDD) you can mount the filesystem to change for example IP settings:

(Might be vda2, vda3 etc. - If you have many partitions you can either just try them or use gparted for a listing with size)

 

mount /dev/vda /mnt

 

After changing the IP simply reboot Server B and your old OS should boot up. You can enlarge the partition if you have unused disk space left on the new machine or you can use the additional space as new partition.

Add Feedback