How to Convert VMDK to VHDX (VMWare to Hyper-V)?

If you are running virtual machines on both VMware ESXi/Workstation and Microsoft Hyper-V, in some cases you may need to convert a VMware virtual machine to Hyper-V format. You can use different V2V migration tools for this. However, it is much faster to simply convert the VMware virtual machine VMDK file to the VHDX format. In this article, we’ll look at several ways to convert VMDK to VHDX.

Convert VMDK to VHDX with StartWind Converter

A third-party StartWind Converter utility allows you to convert VMs from VMware ESXi to Hyper-V.

Using the free StarWind V2V Converter tool, you can convert between the following virtual hard drive formats:

  • .vmdk (VMware);
  • .vhd and .vhdx (Hyper-V);
  • .img.

Download the StartWind Converter utility (free registration required) and install the tool on your computer by running the startwind.exe file.

ADVERTISEMENT

StartWind Converter allows you to remotely connect to VMware ESXi and perform an online conversion of a virtual machine and immediately import it to a Hyper-V server. To do this, select the Remote VMware ESXi Server option.

vmdk to vhdx

You can also convert a local VMDK file (for example, a file of a VMware Workstation virtual machine) to VHDX format. To do this, select Local file > specify the source VMDK file and select destination image format VHD/VHDX (Microsoft Virtual Hard Drive).

convert vmdk to vhdx

Specify the target file.

convert vmdk to vhd

Now you can attach the resulting VHDX disk to the Hyper-V virtual machine.

How to Convert VMDK to VHDX Disk using PowerShell?

You can use a special PowerShell module to convert VMware virtual disks (vmdk) to Hyper-V format (vhdx). Download and install the Microsoft Virtual Machine Converter module on your computer.

vmdk to vhd

Open a PowerShell console as an administrator and import the MVMC module into your session:

Import-Module 'C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1'

To convert your VMDK file to VHDX format, run the command:

ADVERTISEMENT
ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath "C:\SharedVMDK\shareddisk01.vmdk" -VhdType DynamicHardDisk -VhdFormat vhdx -destination C:\VHD

vmdk to vhdx powershell

After executing the command, the shareddisk01.vhdx file will appear in the target directory. You can create a new Hyper-V virtual machine from it or add it to an existing VM.

In our case, converting a 33GB VMware VMDK to VHDX took about an hour.

In some cases, when converting a VMDK disk using ConvertTo-MvmcVirtualHardDisk, an error may appear:

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

convert vmware to hyper-v

The problem is that there was an entry in the VMDK file descriptor that Microsoft Converter could not recognize. To fix the error, you need to remove unrecognized entries from the disk image descriptor.

To do this, download the dsfok tool (https://web.archive.org/web/20190910101150/http://members.ozemail.com.au/%7Enulifetv/freezip/freeware/dsfok.zip).

ADVERTISEMENT

Then extract the VMDK file descriptor with the command:

dsfo.exe "C:\SharedVMDK\shareddisk01.vmdk" 512 1024 "C:\SharedVMDK\ shareddisk01_descriptor.txt"

Open the shareddisk01_descriptor.txt file with Notepad++ and look for the lines that contain the entry listed in the ConvertTo-MvmcVirtualHardDisk error. In our example, we need to find lines with the entry 0000000-0000-0000-0000-00000000.

Comment out the lines with this value by adding a # sign at the beginning of the line. In this example, we commented out the lines:

# ddb.uuid.parent = "0000000-0000-0000-0000-00000000"

# ddb.uuid.parentmodification = "0000000-0000-0000-0000-00000000"

Apply the new descriptor to the VMDK file:

dsfi.exe "C:\SharedVMDK\shareddisk01.vmdk" 512 1024 "C:\SharedVMDK\ shareddisk01_descriptor.txt"

Try running the ConvertTo-MvmcVirtualHardDisk command again. If the error The entry xxx is not a supported disk database entry for the descriptor appears again, you need to extract the descriptor again and comment out the lines with the problematic entries. Repeat the steps several times until ConvertTo-MvmcVirtualHardDisk completes the VMDK to VHDX conversion without errors.

Use Qemu-img to Convert Between VMDK and VHDX Disk Image

In Linux, you can use the qemu-img tool to convert disk images between QCOW2 (KVM, Xen), RAW, VMDK (VMware), VHD/VHDX (Hyper-V), VDI (VirtualBox) formats.

Use the following command to convert a disk image from VMDK to VHDX:

$ qemu-img convert -O vhdx /data/sourceimg.vmdk /data/outputimg.vhdx

You can download qemu-img port for Windows/Windows Server x64 here.

ADVERTISEMENT

In order to convert a VMDK disk image in Windows, run the command:

qemu-img.exe convert source.vmdk -O vhdx -o subformat=dynamic output.vhdx

To get disk image information:

qemu-img.exe info output.vhdx

Connect Converted VHDX Disk to Hyper-V VM

Finally, you can attach the converted VHDX disk to the Hyper-V virtual machine.

  1. Open the Hyper-V Manager console;
  2. Select New > Virtual Machine;
  3. Specify a name and location for the virtual machine files;
  4. Select VM generation (Generation 2 is recommended); vmdk to vhdx converter
  5. Specify the RAM size for the VM on the Assign memory screen;
  6. At the Connect Virtual Hard Disk step, select the Use and existing virtual hard disk item and locate the VHDX file that you received in the previous steps; convert vmdk to vhdx powershell
  7. After the VM has been created, power it on.

VMware and Microsoft use different VM integration tools to give the best VM and user experience. VMware uses VMware tools and Microsoft > Hyper-V Integration Services. You need to remove VMtools from the VM and install Hyper-V integration services.

Now you need to uninstall VMware Tools and device drivers in the guest operating system:

  • On Windows, select Programs > Uninstall a program > select VMware Tool > Remove. You can also use the PowerShell script to force remove the VMware Tools, Program Files, and Windows Services (https://gist.github.com/broestls/f872872a00acee2fca02017160840624_)
  • On Linux, use a Perl script to uninstall VMTools:
    /usr/bin/vmware-uninstall-tools.pl

Now install Hyper-V Integration Services in the guest OS:

Windows:

  1. Download Windows Update CAB file with Hyper-V integration components (KB 3063109 – https://support.microsoft.com/en-us/kb/3063109)
  2. Then install the CAB file using PowerShell:
    $HyperVCab="C:\Downloads\windows6.2-hypervintegrationservices-x86.cab"
    
    Add-WindowsPackage -Online -PackagePath $HyperVCab

Installing Hyper-V LIS (Linux Integration Services) on Ubuntu:

  1. First add hv_modules modules to initramfs-tools:
    # echo 'hv_vmbus' >> /etc/initramfs-tools/modules
    
    # echo 'hv_storvsc' >> /etc/initramfs-tools/modules
    
    # echo 'hv_blkvsc' >> /etc/initramfs-tools/modules
    
    # echo 'hv_netvsc' >> /etc/initramfs-tools/modules
  2. Then install the Hyper-V integration components using your package manager:
    # apt -y install linux-virtual linux-cloud-tools-virtual linux-tools-virtual
    
    # update-initramfs –u
I enjoy technology and developing websites. Since 2012 I'm running a few of my own websites, and share useful content on gadgets, PC administration and website promotion.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.