VMware virtual image to Hyper-V (Win10/2016)
Reference:
http://www.askme4tech.com/how-convert-vmware-virtual-machine-hyper-v
https://stackoverflow.com/questions/37481737/error-when-converting-vmware-virtual-disk-to -hyperv
Principle:
Use the conversion tool provided by Microsoft to convert vmdk to vhdx.
If the conversion tool prompts an error message, it means that a certain configuration of vmdk is not supported. After modifying it with the tool, the conversion can be completed.
Download:
1. Microsoft Virtual Machine Converter 3.0
https://www.microsoft.com/en-us/download/details.aspx?id=42497
Just download mvmc_setup.msi.
2. dsfok tools
http://members.ozemail.com.au/~nulifetv/freezip/freeware/dsfok.zip
3. notepad2 (or notepad++)
https://xhmikosr.github.io/notepad2-mod/
Install: mvmc_setup.msi
Extract: dsfok and notepad2
Steps:
Suppose the vmdk path is: E:\CentOS7_vm\CentOS7_vm-disk1-cl1.vmdk The
converted path is: E:\Hyper-V\Virtual Hard Disks\
dsfok path is: E:\dsfok
Notepad2 path is: E:\ notepad2
1. If you have multiple snapshots, it is recommended to export VMWare Workstation as ovf, then import it, and then clone it to a lower VMWare version through the upgrade command.
2. Open PowerShell as administrator, then enter the following command Convert
PS> Import-Module "C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1"
PS> ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath "E:\CentOS7_vm\CentOS7_vm- disk1-cl1.vmdk" -DestinationLiteralPath "E:\Hyper-V\Virtual Hard Disks\" -VhdType DynamicHardDisk -VhdFormat Vhdx
If the conversion is successful, go to step 5; if the following error message appears, go to the next step.
ConvertTo-MvmcVirtualHardDisk : The entry 4 is not a supported disk database entry for
the descriptor.
At line:1 char:1
+ ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath "E:\CentOS7_vm\CentO ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Accel...nversionService:DriveConv
ersionService) [ConvertTo-MvmcVirtualHardDisk], VmdkDescriptorParseException
+ FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Comman
ds.ConvertToMvmcVirtualHardDiskCommand
ConvertTo-MvmcVirtualHardDisk : One or more errors occurred.
At line:1 char:1
+ ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath "E:\CentOS7_vm\CentO ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Accel...nversionService:DriveConv
ersionService) [ConvertTo-MvmcVirtualHardDisk], AggregateException
+ FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Comman
ds.ConvertToMvmcVirtualHardDiskCommand
3. Run in CMD window:
E:\> e:\dsfok\dsfo "E:\CentOS7_vm\CentOS7_vm-disk1-cl1.vmdk" 512 1024 descriptor1.txt
OK, 1024 bytes, 0.016s, MD5 = 14834e920b6019bb8e05823a67c4162c
E:\> e:\notepad2\notepad2.exe descriptor1.txt
Add a pound sign before ddb.toolsInstallType = "4" on line 20 #Delete
one NUL in the last line to ensure that it is still 1024 bytes (status bar is 1.00KB)
close notepad2 after saving
E:\> dsfi "E:\CentOS7_vm\CentOS7_vm-disk1-cl1.vmdk" 512 1024 descriptor1.txt
OK, written 1024 bytes at offset 512
4. Go back to PowerShell again and run the conversion command
PS> ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath "E:\CentOS7_vm\CentOS7_vm-disk1-cl1.vmdk" -DestinationLiteralPath "E:\Hyper-V\Virtual Hard Disks\" -VhdType DynamicHardDisk -VhdFormat Vhdx
waits for the conversion to complete.
5. Open the Hyper-V manager, create a new virtual machine, then select the disk that already exists and browse to vhdx
6. Start the virtual machine and repair the system
The conversion process is complete.