Qemu-img convert vmdk to vhdx

I need to convert a vmdk to vhdx to be used with Hyper-V. I converted the file using this:
qemu-img.exe -p -f vmdk -O vhdx -o subformat=dynamic C:\Hyper-V\Imports\VMWare\FreeRadiusAAMES\FreeRadiusAAMES.vmdk C:\Hyper-V\VHDs\FreeRadius.vhdx

When I attempt to start the Hyper-V virtual machine I get this error:

Failed to Power on with Error 'The requested operation could not be completed due to a virtual disk system limitation. Virtual hard disk files must be uncompressed and unencrypted and must not be sparse.

Hi there,

So, take all this with a grain of salt as I’m in the middle of moving some stuff and have no access to boxen, hence am writing off of my knowledge and access to documentation.

First of all, according to qemu-img’s documentation, you need to specify a command to it. From what you posted:

It seems you forgot to specify the convert command. Your command should probably look like this:

qemu-img.exe convert -p -f vmdk -O vhdx -o subformat=dynamic C:\Hyper-V\Imports\VMWare\FreeRadiusAAMES\FreeRadiusAAMES.vmdk C:\Hyper-V\VHDs\FreeRadius.vhdx

Also, if you can spare the space and thanks to my lack of trust on qemu-img’s proper handling of conversion, could you try doing the conversion as fixed size instead of dynamic? Worse comes to worse, try converting it to a VHD instead of a VHDX. You should be able to then convert from VHD to VHDX from within Hyper-V.

I should be able to do the same tests tomorrow morning and I’ll post the results.

EDIT: Just noticed the post is more than a month old. I’m still getting used to Discourse’s layout. Hopefully (only not) you’re still fighting with this so my post doesn’t come off as useless.

1 Like

A month is fine, it is not excessively old, and people do find old questions here from Google, so an answer might still help others who stumble across it.

Probably best not go answering all the questions over 9 months old tho…

I discovered starwind’s V2V converter and did it that way. I am still interested to know if qemu-img will work though. Thank you for the reply.

Ok, so the issue seems to be with Hyper-V rather than with VMWare or QEMU. The command you used did end up in an error for me:

PS C:\Users\vhns\Downloads\Microsoft Windows 95 [VMware VM]\Windows 95> & 'C:\Program Files\qemu\qemu-img.exe' convert -p -f vmdk -O vhdx -o subformat=dynamic '.\Windows 95.vmdk' '.\Windows 95.vhdx'
**  (0.00/100%)
ERROR:../../../util/oslib-win32.c:61:qemu_try_memalign: assertion failed: (is_power_of_2(alignment))
PS C:\Users\vhns\Downloads\Microsoft Windows 95 [VMware VM]\Windows 95>

Changing it to:

PS C:\Users\vhns\Downloads\Microsoft Windows 95 [VMware VM]\Windows 95> & 'C:\Program Files\qemu\qemu-img.exe' convert -p -f vmdk -O vpc '.\Windows 95.vmdk' '.\Windows 95.vhd'
    (100.00/100%)
PS C:\Users\vhns\Downloads\Microsoft Windows 95 [VMware VM]\Windows 95>

did the trick.
Now, that image still throws the same error in Hyper-V, both when trying to boot it directly or converting it from VHD to VHDX through Hyper-V’s manager wizard. I was able to boot the image just fine through QEMU (yes, you can boot any of the qemu-img supported image files in QEMU itself).

The reason for the conversion was to run in Hyper-V. Thankfully starwind’s tool works.

If you’re willing to use windows to do it, star wind v2v converter can do it and is free.

edit:
ah, beaten. good to see others have discovered it too :smiley:

If you install SCVMM it can control vCenter and do conversions from vSphere to HyperV as well.