Converting Hyper-V .vhdx to KVM .img format
Migrating from Hyper-V to KVM on Ubuntu. Found a good way to convert those pesky Hyper-V images so that I can spin them on the new Ubuntu servers.
Here's the low down.
Step 1 Export the VM's from Hyper-V manager
From within your Hyper-V manager make sure you shut down the VM you'll be exporting. Also, make sure you've deleted and merged all checkpoints that make be associated with the VM.
Step 2 Check the health of the .VHDx you exported
I'm assuming after exporting that you went ahead and transfered the VHDx file to your Ubuntu server that is running KVM. If you have't, do so now and head back when the transfer is completed.
To check the image and confirm no errors issues the following on your Ubuntu server.
qemu-img check -r all Bench-Dev.vhdx
Hopefully everything checks out and the output informs you there are no errors.
Step 3 Convert the VDHx to IMG file format
Go ahead and issue the following command to convert the image file to .img.
qemu-img convert -O raw /location/of/vhdx/file.vhdx location/of/img/file.img
You should now have your .img file ready and converted when that finisheds up.
From here create the VM in KVM and make sure you provide it the same spec's you did in Hyper-V. So if you used 4098 GB of RAM and 2 cores. Create the KVM VM with the same values.
Not to hard huh?
My 2