Converting Hyper-V to KVM
-
I had the time and spare disk space to export a copy of all my Hyper-V virtual machines to a NAS (Fedora 30 system with a public Samba share). So I took advantage of this to convert the system to KVM on Fedora 30.
-
Shutdown the VM to be migrated. You need to ensure everything is in a consistent state.
-
With Hyper-V Manager on your control system and then select each VM and choose Export.
-
Enter the path to the location to store the export. In my case the samba share.
-
Make a note of the processor count, memory, and MAC (optional) of the systems you are going to export.
-
Repeat for all the VMs that you are moving
-
Copy the
vhdx
of the exported VM to the KVM server. I dropped everything in the/var/lib/libvirt/images
folder because that is the default folder KVM uses for disk images.
Hyper-V exports things into a fixed structure ofVM Name
->Virtual Hard Disks
->vhdx
file.
-
Install the package
virt-v2v
on your KVM host.
dnf install -y virt-v2v ==================================================================================================================================== Package Architecture Version Repository Size ==================================================================================================================================== Installing: virt-v2v x86_64 1:1.40.2-4.fc30 fedora 1.7 M Installing dependencies: .............more deps..........
- Now you can begin to convert the
vhdx
disks toqcow2
witth virt-v2v command.
sudo virt-v2v -i disk /var/lib/libvirt/images/Naggaroth.vhdx -o local -of qcow2 -os /var/lib/libvirt/images/
-
When is start sup you can see it opens the disk and loads a temp virtual machine to convert things.
-
Once it completes, do not just close your session. Make a note of the guest OS and boot type listed.
-
You will see the converted
vhdx
named the same with-sda
appended to the end. You can now delete the*.vhdx
and*.vhdx.xml
. I attempted to use thexml
to import the VM, but it did not work. Likely jsut some setting needing changed or something. But I did not spend anytime troubleshooting it.
-
Create anew VM with Virtual Machine Manager.
-
Choose
Import existing disk image
and click Forward.
-
Browse to the created
*.vhdx-sda
disk and also specify the OS correctly at the bottom of the dialog. Then click Forward.
-
Specify the same amount of memory as the system had in Hyper-V as well as the number of CPUs, then click Forward.
-
Give the VM a name, click the checkbox to customize and setup the networking as desired (I like to use the macvtap, but whatever you want). Now click Finish.
-
The details of the configuration opens automatically. If this is a UEFI install, you have to change the Firmware type from BIOS (default) to UEFI. Click Apply. If you have any other specific settings you want preserved (like MAC address), set them now. When your changes are complete, click
Begin Installation
at the top of the window.
-
It will only take a moment, and the VM will power on and boot. Assuming everything was successful, you will now have a working VM.
-
The first login will be briefly CPU intensive as the system updates itself.
-
-
The only Debian system I have failed to convert. It was only a test JitsiMeet install so not important, but I will take time later to see if I can make it convert.
-
The v2v conversion seems limited to a single CPU.
-
Is this a lab you've converted from Hyper-V to KVM or production (client and or business workloads, aka not production for your house).
-
qemu-img convert
is what I've used before successfully. -
@DustinB3403 said in Converting Hyper-V to KVM:
Is this a lab you've converted from Hyper-V to KVM or production (client and or business workloads, aka not production for your house).
This is my personal server I use to run various stuff as well as to run lab things.
It was Hyper-V 2012R2 upgraded to Hyper-V 2016.
Now it is KVM on Fedora 30.
-
@Obsolesce said in Converting Hyper-V to KVM:
qemu-img convert
is what I've used before successfully.I've had issues with that converting things. virt-v2v has worked better for me.
-
Everything converted, except the JitsiMeet instance. I did all of it via
virt-manager
andssh
by way of ZeroTier (the 10.224.0.0/24 network is ZT).
-
pages on daerma.com load slow. No idea why, it is a basic WP site.
obelisk.daerma.com loads at what seems a normal pace.
naggaroth.daerma.com doesn't seem to have any issues either.
-
Is all your linux VMs using virtio drivers for network?
-
@black3dynamite said in Converting Hyper-V to KVM:
Is all your linux VMs using virtio drivers for network?
Umm whatever virt-manager uses by default.
-
@black3dynamite said in Converting Hyper-V to KVM:
Is all your linux VMs using virtio drivers for network?
-
Comments and steps organized in initial post.
-
@JaredBusch said in Converting Hyper-V to KVM:
pages on daerma.com load slow. No idea why, it is a basic WP site.
Removed an old IP from the router, and it all works faster. That makes no sense. But it was something that needed cleaned up.
-
Hey @JaredBusch if you Google about converting Hyper-V to KVM, this is Google's built in process now! They link this article as the "official" Google chosen reference document for this process!