Converting a VMDK to VHD

The Microsoft Virtual Machine Converter (MVMC) includes the Microsoft Virtual Disk Converter tool (MVDC.exe) that converts a VMDK file to a VHD file.

http://www.microsoft.com/en-ca/download/details.aspx?id=42497

MVDC SrcDisk  DstDisk  [/?]  [/Dyn]

SrcDisk  Specifies the source VMDK disk path to be converted.
DstDisk  Specifies the path for the converted disk.
[/?]     Show Help
[/Dyn]   Indicates the destination disk should be dynamic rather than fixed.

For example:

C:\Program Files (x86)\Microsoft Virtual Machine Converter Solution Accelerator>mvdc "D:\VM\Windows Server 2008 R2 x64\Windows Server 2008 R2 x64.vmdk" "D:\VM\Windows Server 2008 R2 x64\Windows Server 2008 R2 x64.vhd"
Step 1 of 3: Loading Source Disk...
Step 1 of 3: Loading Source Disk Completed.
Source file found of size 40.0 GB.
DiskGeometry:
   Cylinders:        5221
   Tracks/Cylinder:  255
   Sectors/Track:    63
   Bytes/Sector:     512
   MediaType:        FixedMedia
Step 2 of 3: Creating Destination Disk...
Step 2 of 3: Creating Destination Disk Completed.
Destination file created of size 40.0 GB.
DiskGeometry:
   Cylinders:        5221
   Tracks/Cylinder:  255
   Sectors/Track:    63
   Bytes/Sector:     512
   MediaType:        FixedMedia
Step 3 of 3: Copying raw data...
Step 3 of 3: Copying raw data completed.
Conversion Complete!  The converted file is located at: D:\VM\Windows Server 2008 R2 x64\Windows Server 2008 R2 x64.vhd

By default it creates a fixed sized VHD, which is also what is required for Azure VMs.

After converting it to VHD, it is a good idea to boot it up locally in Hyper-V, make sure it is configured for a dynamic IP and that RDP is enabled and you are able to successfully RDP into it. Then if you want to use it as a base image, you'll also need to generalize it with sysprep. If you want to use it for a single Azure VM, don't run sysprep, but upload it as a disk instead of as an image (Csupload Add-Disk instead of Add-PersistentVMImage).

See also: http://www.windowsazure.com/en-us/manage/windows/common-tasks/upload-a-vhd/


I use VirtualBox (actually the CLI vboxmanage, installed with VirtualBox) for this, I had no issues installing VirtualBox alongside Hyper-V, but you can't run them at the same time, thats another thread!

Anyway at an elevated (Admin mode) prompt use

cd %programfiles%\Oracle\VirtualBox

vboxmanage clonehd "C:\tmp\file.vmdk" "C:\tmp\file.vhd" -format VHD

Note, You can extract a VMDK from an OVA with 7zip!