次の方法で共有


Convert VMDK to VHD fails with the entry 2 is not a supported disk database entry

Hi All

I have been playing around with a PBX platform that runs only on VMWare and of course in vmdk format. I was keen to use it in Hyper-V so I needed to build in VMWare and convert to Hyper-V after the fact. Microsoft provide a VMDK to VHD/VHDX converter tool called the Microsoft Virtual Machine Converter. You can download it here https://www.microsoft.com/en-us/download/details.aspx?id=42497.

The nice thing about the tool is that you can convert using Powershell the vmdks you have. Anyway, when I ran the conversion cmdlet I got the error below.

PS E:\VMDK> ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath E:\VMDK\vm1.vmdk -VhdType DynamicHardDisk -VhdFormat vhdx -DestinationLiteralPath e:\vmdk\vhdx

ConvertTo-MvmcVirtualHardDisk : The entry 2 is not a supported disk database entry for the descriptor.

At line:1 char:1

+ ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath E:\vmdk\vm1.vmdk - ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : WriteError: (Microsoft.Accel...nversionService:DriveConversionService) [ConvertTo-MvmcVi

rtualHardDisk], VmdkDescriptorParseException

+ FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Commands.ConvertToMvmcVirtualHardDiskC

ommand

 

ConvertTo-MvmcVirtualHardDisk : One or more errors occurred.

At line:1 char:1

+ ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath E:\vmdk\vm1.vmdk - ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : WriteError: (Microsoft.Accel...nversionService:DriveConversionService) [ConvertTo-MvmcVi

rtualHardDisk], AggregateException

+ FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Commands.ConvertToMvmcVirtualHardDiskC

ommand

 

So not being a VMWare guy I had not much idea of what the error was. Luckily others have hit the issue before and I stumbled onto a workaround on stackoverflow. https://stackoverflow.com/questions/37481737/error-when-converting-vmware-virtual-disk-to-hyperv. The recommendation was to use a dsfok toolset to update the vmdk descriptor information on the file, to make the Microsoft VM Converter tool happy. Once doing this it worked a treat. I used the commands

C:\scratch\dsfk\dsfok>dsfo.exe "e:\vmdk\vm1.vmdk" 512 1024 descriptor1.txt

OK, written 1024 bytes at offset 512

I then edited the descriptor1.txt file in Notepad++ and commented out the tools.InstallType attribute.

Then I needed to reapply the descriptor to the vmdk to make it convertible. You use the dsfi.exe tool to do that.

#After you edit the descriptor.txt file

C:\scratch\dsfk\dsfok>dsfi.exe "e:\vmdk\vm1.vmdk" 512 1024 descriptor1.txt

OK, written 1024 bytes at offset 512

You can get the dsfok tools from here https://www.softpedia.com/get/System/Back-Up-and-Recovery/dsfok.shtml

 

And yehhhh, now my VMDK convert Powershell is working……

ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath E:\VMDK\vm1.vmdk -VhdType DynamicHardDisk -VhdFormat vhdx -DestinationLiteralPath e:\vmdk\vhdx

Now to see if can get the VM running in Hyper-V. Fingers crossed as will be kewl to add to my SfB lab

 

Happy Skype'ing

 

Steve