Have you ever wanted to import an OVA into services like Linode, Vultr, AWS, and others? Have you ever wanted to get your VM off of one of those services? Well let me introduce the magic of SSH, dd, and Gzip.
To get started, you need to boot Linux on both VM’s and have root access. To make it easy, you can boot Ubuntu live CD’s on them. The machine you are copying to (the new one) needs to be accessible on the open internet.
On the live CD on the new machine, type the following:
sudo -i passwd
And input a somewhat secure password.
Next, edit the sshd config to allow root login:
Save and exit with control+x.
Next, start the SSH daemon:
systemctl start sshd
Now you should be able to connect to the new machine. On the old machine, try to ssh in to the box with the root user and the password you set.
Next, you need to check the drive labels for both the old and the new machine.
fdisk -l will help you with that. Finally, on the old machine, run this long command, and it will begin the disk transfer:
dd if=/dev/OldDrive | gzip -c | ssh root@NewIP 'gunzip - | dd of=/dev/NewDrive status=progress'
You can also clone the old disk to an img file, which can then be read to other disks later. This can be done by modifying the above command slightly to be:
dd if=/dev/OldDrive | gzip -c | ssh NewComputer@NewIP 'gunzip - | dd of=/path/somewhere/clone.img status=progress'
Final example, if you are cloning to a file you should be able to ssh from the new machine to the old one like this:
ssh root@OldIP 'dd if=/dev/OldDrive | gzip -c' | gunzup - | dd of=/path/somewhere/clone.img status=progress'
If you appreciate our content and would like to be notified when we post a new article, you can subscribe for notifications using this form: