Migrating a Virtual Machine from Scaleway to Proxmox
I'm not against Scaleway - I think they offer a great service! Still, I wanted to move one particular virtual machine away without dealing with the hassle of configuring everything again. Here are the general steps which worked for me:
- Create a backup image of your instance from the Scaleway console. This isn't for protection, it's so we can mount it as a read-only file system.
- Create a new instance using this image. You'll need to make sure it's sized correctly but Scaleway does a good job of letting you know if there's something wrong.
/etc/fstabto mount everything read only. This just involves changing the things that say
ro. You might also want to comment out any mount points which aren't entirely necessary, such as
/homeif you keep this on a separate drive.
- (optional) Install
zerofree. This will allow us to strip out any of the old unreferenced data from the root fs which will make it more compressible. If you have a very fast connection, you might want to skip this. I found applying zerofree to my root fs to be very fast (20GB).
- Reboot. Once it comes back up, you can run zero free if you want. e.g.
zerofree -v /dev/vda1. This has to be done after a reboot because the it needs to be unmounted or mounted read-only before zerofree will touch it.
- We can begin the transfer and download the Scaleway image. I used dd for this, with gzip to speed things up.
ssh root@remote "dd if=/dev/vda | gzip" | gzip -d | dd of=scaleway.img status=progress
- Once it's transferred, you can delete the new instance from Scaleway, along with the backup image taken earlier. I recommend keeping the original instance running for a few days until you are sure everything has been transferred safely.
- Login to your proxmox web interface and create a new instance, ensuring that the root drive is the same size, if not larger, than the main block device on your Scaleway instance. I created my virtual disk as a zfs subpool in
data0, so I used the following to "import" the image from Scaleway.
dd if=scaleway.img | ssh root@pve "dd of=/dev/data0/vm-121-disk-0 status=progress"
- In case we imported to a disk which was slightly larger, we'll want to use fdisk to correct the GPD headers, and the backup GPT entry at the end of the disk (it won't be at the end of the disk if we imported to a larger disk). We can use
fdiskfor this, simply rewriting the partition table.
fdisk /dev/data0/vm-121-disk-0 w
- From the Proxmox web interface, change the instance's BIOS to "OVMF (UEFI)", since Scaleway uses EFI to boot their virtual machines. We'll also need to add a blank EFI disk to stop Proxmox form complaining. The EFI will pick out the partition from our transferred disk without issues. Since Scaleway doesn't use graphical output on their VMs (opting for serial instead), we'll want to add a virtual serial port and set the Display to
- You can now start up the instance and go to the console. It should boot up fine and allow you to login with your instances password. At this point, everything will still be mounted as read-only, so we'll remount this:
mount -o remount,rw /
- You can now update your
/etc/fstabfile to make these partitions
- At this point there are a few things which you might want to do, but it's up to you.
- Install qemu-guest-agent
/usr/local/sbin/scw-*, since these are helper scripts for running in a Scaleway environment.
/etc/systemd/system/scw-*, since these services will no longer be useful, and will fail to start.
- Install NetworkManager to make things easier on yourself.
That's it! Worked for me, hope it works for you too!