Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when converting VmWare virtual disk to HyperV

I received VmWare image from my client for some testing purposes. I need to convert it to Hyper-V. I followed steps in http://www.askme4tech.com/how-convert-vmware-virtual-machine-hyper-v. I installed Microsoft Virtual Machine Converter and started to convert virtual disks in PowerShell. However I'm getting eror:

C:\Windows\system32> ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath "c:\temp\disk2.vmdk" -DestinationLiteralPath "c:\data\HyperV\PH\" -VhdType DynamicHardDisk -VhdFormat Vhdx  ConvertTo-MvmcVirtualHardDisk : The entry 1 is not a supported disk database entry for the descriptor. At line:1 char:1 + ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath "c:\temp\disk2.vmdk" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : WriteError: (Microsoft.Accel...nversionService:DriveConversionService) [ConvertTo-MvmcVirtualHardDisk], VmdkDescriptorParseException     + FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Commands.ConvertToMvmcVirtualHardDiskCommand  ConvertTo-MvmcVirtualHardDisk : One or more errors occurred. At line:1 char:1 + ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath "c:\temp\disk2.vmdk" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : WriteError: (Microsoft.Accel...nversionService:DriveConversionService) [ConvertTo-MvmcVirtualHardDisk], AggregateException     + FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Commands.ConvertToMvmcVirtualHardDiskCommand 
like image 964
eXavier Avatar asked May 27 '16 10:05

eXavier


People also ask

Can you convert VMware to Hyper-V?

Microsoft Virtual Machine Converter: This standalone tool converts VMware VMs to Hyper-V hosts or Azure VMs. It also converts physical machines and disks to Hyper-V hosts. IMPORTANT: This tool is in the process of retirement.

Why is VMware not compatible with Hyper-V?

This incompatibility is caused by Hyper-V because virtualization extensions are not exposed to type 2 hypervisors installed on a Windows machine where the Hyper-V role is enabled.

Can VMware use VHDX files?

The most popular virtual disk formats are VHD, VHDX, and VMDK. You cannot import VHD to VMware products until you convert Hyper-V VHD to VMware VMDK.


1 Answers

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.

like image 169
eXavier Avatar answered Oct 10 '22 17:10

eXavier