Error when converting VmWare virtual disk to HyperV

I tried the above solution, but in my descriptor there wasn't toolsInstallType property so it didn't worked (with the same error).

After some research I found this tool: https://cloudbase.it/qemu-img-windows/

The command was like this:

qemu-img.exe convert c:\PATH_TO_FILE\disk.vmdk -O vhdx c:\PATH_TO_FILE\disk.vhdx -p

The documentation for this tool is here QEMU Documentation the -p flag allows you to see progress of the convert.

Also I found it easier to work with since it's a portable tool. In this specific case it does not require also to fix the bootloader, I just attached the vhdx to the new VM and it started successfully.


I had a this problem too trying to convert a VMWare image to VHD. My solution is similar to eXavier's, but I was able to do it with just a text editor.

The reason I could do a simpler fix was that the vmdk I got from VMWare was a small text file that referred to a number of other files. It looked like this:

# Disk DescriptorFile
version=1
encoding="windows-1252"
CID=4bd4d907
parentCID=ffffffff
isNativeSnapshot="no"
createType="twoGbMaxExtentSparse"

# Extent description
RW 8323072 SPARSE "Windows Server 2012-s001.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s002.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s003.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s004.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s005.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s006.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s007.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s008.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s009.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s010.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s011.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s012.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s013.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s014.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s015.vmdk"
RW 983040 SPARSE "Windows Server 2012-s016.vmdk"

# The Disk Data Base 
#DDB

ddb.adapterType = "lsilogic"
ddb.geometry.cylinders = "7832"
ddb.geometry.heads = "255"
ddb.geometry.sectors = "63"
ddb.longContentID = "439d288830654baf53d1f9594bd4d907"
ddb.toolsInstallType = "1"
ddb.toolsVersion = "10240"
ddb.uuid = "60 00 C2 97 21 a0 4e af-fc 21 68 15 2f 12 7f 22"
ddb.virtualHWVersion = "12"

The fix was to remove the #Disk Database line and all those below it, using a text editor, so that my file looked like this:

# Disk DescriptorFile
version=1
encoding="windows-1252"
CID=4bd4d907
parentCID=ffffffff
isNativeSnapshot="no"
createType="twoGbMaxExtentSparse"

# Extent description
RW 8323072 SPARSE "Windows Server 2012-s001.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s002.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s003.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s004.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s005.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s006.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s007.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s008.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s009.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s010.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s011.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s012.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s013.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s014.vmdk"
RW 8323072 SPARSE "Windows Server 2012-s015.vmdk"
RW 983040 SPARSE "Windows Server 2012-s016.vmdk"

It then converted to a VHD with no problems.


I found some adhoc solution - a bit hack perhaps but it works at least.

Digging into similar issues found on google I came to a tool to extract disk descriptor out of the VMDK file. The content of the descriptor for my VMDK was something like this:

# Disk DescriptorFile
version=1
encoding="windows-1252"
CID=5379bf0f
parentCID=ffffffff
isNativeSnapshot="no"
createType="monolithicSparse"

# Extent description
RW 209715200 SPARSE "00054_C8PHS1096_151216-disk2.vmdk"

# The Disk Data Base 
#DDB

ddb.adapterType = "lsilogic"
ddb.geometry.biosCylinders = "13054"
ddb.geometry.biosHeads = "255"
ddb.geometry.biosSectors = "63"
ddb.geometry.cylinders = "13054"
ddb.geometry.heads = "255"
ddb.geometry.sectors = "63"
ddb.longContentID = "64d4e008b7227bcce8aa54995379bf0f"
ddb.toolsInstallType = "1"
ddb.toolsVersion = "10241"
ddb.uuid = "60 00 C2 96 f7 70 f2 fd-b5 02 9e 46 6c df 00 2e"
ddb.virtualHWVersion = "10"

The error message together with the content of the extracted descriptor came to my attention, specifically the line:

ddb.toolsInstallType = "1"

as it contains the strange value of 1 from my error message. I edited the descriptor - just comment out that single line with # (hash mark), injected it back into VMDK and voila - the conversion works now.

Credits to this link https://communities.vmware.com/thread/343214?start=0&tstart=0 and of course to tools by Dariusz Stanislawek.

Just for reference, the steps I have done:

  • download and extract dsfok tools
  • use dsfo.exe "c:\temp\disk2.vmdk" 512 1024 descriptor1.txt to extract the descriptor
  • edit the descriptor file in Notepad++: comment the above mentioned line (as I added the extra single character (#) I also deleted one NULL character from the end to keep the file size of 1024 bytes (not sure if this is needed).
  • use dsfi.exe "c:\temp\disk2.vmdk" 512 1024 descriptor1.txt to inject the descriptor back into the VMDK
  • repeat these steps for the other disk (my VM has two .vmdk files)
  • reissue the ConvertTo-MvmcVirtualHardDisk command

REMARK

After creating VM in Hyper-V, the machine didn't boot, it remained in black screen with fast blinking cursor (so called black screen of death). I don't know if it was caused by the conversion or by the fact that original disks in VMWare had been SCSI while I attached them as IDE. To fix it, I attached DVD with image of Windows and booted from DVD. I ran the Rapair system, started the command line and ran

bootrec.exe /fixBoot

Finally, the VM boots and runs.. end of story.