# How to migrate VPS

Source: https://www.hukot.net/community/en/tutorials/how-to-migrate-vps
Updated: 2026-11-25

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](http://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/vdb** will be the disk on the next VPS we want to move the server to. Check the disk on the target VPS with `lsblk` before copying, dd overwrites all of it. 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`

With the netcat-traditional package the port has to be given with a switch: `nc -l -p 19000`.

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 ;)

###
