How to migrate VPS
If you need to migrate a virtual server between two hosts over a network, you can use this simple tutorial using DD over SSH or Netcat from a Linux environment - virtually any OS can be migrated this way. You can also safely migrate between different virtualization platforms this way, since you are transferring the internal "raw" filesystem data of the OS being transferred.
The instructions assume a basic knowledge of the Linux OS.
Of course, this way we can back up the entire disk image to a file.
It is important that some live Linux distributions are booted on both sides (so that the transferred disk is not directly used by the OS) - personally I like to use GRML, which is part of the live-Linux in the admin interface of our hosting www.hukot.net.
First method: DD via SSH
This method is the slowest in terms of performance, but probably the easiest :) In the example, we assume that /dev/sda is the disk on the VPS(VM) being copied and /dev/vda will be the disk on the next VPS we want to move the server to. Of course the disk must be the same or larger than the one on the original VPS.
dd if=/dev/sda | ssh root@ip_of_new_vps "dd of=/dev/vdb"
Second method: DD via Netcat
This method gives us the ability to use compression and send the stream without the "wrapper" of SSH. In this tutorial, we will use compression and transfer over tcp port 19000 - so if you need to enable it on FW, this is something to keep in mind. On the new server/VPS where we want to make the copy operational:
nc -l 19000|bzip2 -d|dd bs=16M of=/dev/vdb
On the source server/VPS:
dd bs=16M if=/dev/sda|bzip2 -c|nc ip_of_new_server 19000
INFO: if using the second method, you can save up to 70% of time vs SSH ;)