Číst česky →

VPS migration over the Internet

1 min read Petr Pomajbík Linux Basics Backups VPS IPv4

If you want to migrate / transfer the VPS from one host to another and don't want to reinstall the system again, you can use the disk transfer of the current virtual server and then just reconfigure the network.

Example:
I am migrating VPS A (IP 192.168.1.222) to VPS B (IP 192.168.90.99)

Both systems need to be booted into a live distro, e.g. GRML. Set up their network and SSH access.

On VPS A run a disk copy and move:

dd if=/dev/sda bs=4M | ssh root@192.168.90.99 "dd of=/dev/vda bs=4M"

Before you start, check the disk names on both servers with lsblk. Writing to the wrong disk irreversibly erases its data.

After the transfer, just boot VPS B and modify the network configuration on the new host. If the disk size is different, you need to extend the partition layout:

growpart /dev/vda 1
e2fsck -f /dev/vda1
resize2fs /dev/vda1

growpart (package cloud-guest-utils) grows the partition to the disk size and resize2fs then grows the file system. resize2fs alone does not grow the partition. Check the partition number (1 here) with lsblk.

This tutorial assumes basic Linux administration. In case you are not sure, please contact our support.