Migrating to Hyper-V: Convert VMDK to VHDX14 Feb 2020
I have been on a desktop OS and tools journey for the last six or nine months. Long story short, my 2012 Retina MacBook Pro gave up the ghost in a most unpleasant way. I grabbed a System76 laptop, and gave Linux on the desktop a shot for a little while. Eventually I repaved that and moved to Windows 10 full time. As part of that, I enabled WSL 2, which breaks VMware desktop products. No biggie, one can convert VMs, right?
It is assumed that you have the following:
- WSL 2 
- Ubuntu (in WSL that is)
Note: You can get
qemu-imgas a native tool for Windows. I used the Linux version as I had a bit more experience with it.
There are three basic parts of this process: Converting the VMDK, Importing into Hyper-V, and Installing integration services.
Converting from VMDK to VHDX
This stage will be done entirely within WSL/Ubuntu, so open a terminal and then use the following commands:
- Ensure you have
sudo apt update sudo apt install qemu-utils # --output truncated-- #
- Convert the image:
PathToVMDK="/mnt/c/Users/bunchc/vms/win7/win7.vmdk" PathToVHDX="/mnt/c/Users/bunchc/vms/win7/win7.vhdx" $ qemu-img convert $PathToVMDK -O vhdx $PathToVHDX -p
The command tells
qemu-img to convert the VMDK specified in
PathToVMDK with an output type (
-O vhdx) of vhdx and store the resulting image at
qemu-img to display the progress as it converts. You will need to change the
PathTo variables to reflect your environment.
Note: There are some tools that will do this in PowerShell  . However, they can be rather flaky depending on the source VMDK.
qemu-imgwas quite a bit more robust in this regard.
Importing into Hyper-V
Once the conversion is complete, you can import the VM into Hyper-V as you would any other vhdx. You will want to be careful when selecting which generation, that is, unless you installed the VM with UEFI, you will want to select ‘Generation 1’.
Once Imported, edit the settings of the VM.
When happy with the settings power the VM on, log in, uninstall VMware Tools and reboot, then prepare to install Hyper-V integration services.
Installing integration services
The Hyper-V integration services will generally be installed seamlessly via Windows Update. If this is not the case, or you are using an older version of Windows, download the integration tools , and then use the following command from an elevated command prompt to install them:
dism.exe /Online /Add-Package /PackagePath:C:\Users\bunchc\Desktop\windows6.x-hypervintegrationservices-x86.cab
The following pages were used to help make this post: