Migrating a Proxmox VM to another hypervisor
Recently I had to migrate a Linux VM from my Proxmox server to my UnRAID server. The VM was in a ZFS pool, and I’ve set up Proxmox to use my UnRAID NAS server as a CIFS backup target. Here’s a quick how-to on how to perform the conversion and the migration of the virtual disk between both machines.
1- Backup the VM using Proxmox’s backup solution
As I said above, I use my UnRAID server as a backup target for my VM’s / LXC containers running on Proxmox. Proxmox makes backups using the VMA backup format, and the files are then compressed with Zstandard.
So in order to avoid the hassle to deal with compressed files, let’s make a new backup of the VM to migrate, without compression :
You get a xxxx.vma dump file at your backup location, which basically contains the virtual disk and the VM conf file.
2- Extract the virtual disk from the .vma dump
Next, log in to your proxmox instance using SSH, or using the console, and navigate to your mounted backup folder. In my case, my NAS share is mounted on /mnt/ . Your location will depend on your actual backup target / file system.
You now want to extract the HDD file from the xxx.vma file :
vma extract -v [your_file.vma] [target_folder]
3- Convert the virtual disk
Once the extraction is done, we’re going to convert the virtual disk using the qemu-img tool. This tool can convert virtual disks to a lot of common formats : vmdk, img, vdi, vhdx, qcow2, dmg…Please refer to the documentation of this powerful tool. I think qemu-img comes with Proxmox by default, if not you can easily install it with
apt-get install qemu-utils.
Syntax example :
qemu-img convert -p -f [source_format] -O [destination_format] [source_file] [destination_file]
In my case, I want to convert a .raw virtual disk to a qcow2.img disk :
qemu-img convert -p -f raw -O qcow2 sourcedisk.raw destinationdisk.img
The -p switch shows conversion progress, it might takes a while depending on your source file size.
4- Import the file to the new hypervisor
Last steps, you can now move / copy / transfer the newly created virtual disk file and import it to your hypervisor of choice. In my case it was a simple file moving operation.
- Create a new VM with an existing HDD
- Keep the same virtual BIOS settings
- Don’t forget to copy the MAC address of your VM in Proxmox and paste it in your hypervisor if your VM uses DHCP for instance
- Copy and import the UUID too (especially for licenced OSes like Windows, not required for a Linux VM)
- Don’t forget to reconfigure your network interface with your new hypervisor. For instance, in my Ubuntu 20.04 VM, using netplan, I had to edit
/etc/netplan/mynetconf.ymlwith the new interface to get the network up and running again.
This method has been tested with various Linux VMs, and has been working with great success for me. I’ve been able to export VMs to VMware Workstation, to UnRAID (KVM) and to Hyper-V.
For Windows VMs, depending on your case, you can also use an imaging / backup application like AOMEI backrupper or Acronis True Image directly in your Proxmox VM, then restore the backup file to another VM in another hypervisor (documentation here) . I tested this solution recently with a Windows Server VM and it’s been working flawlessly.