Virtual Hard Drive Conversions: VHD, VMDK, VMWTF

Working with SharePoint, virtual machines are a way of life.  At SusQtech, I end up working with a variety of different virtualization formats while supporting our customers and partners.  The virtualization platforms that I see most frequently are Microsoft Hyper-V, VMware, VirtualBox, and recently, Xen.  I really don’t have the time, desire, resources, or money to run so many dedicated virtualization environments.  What I need is a very stable virtualization platform that lets me import all of the other virtual environment drives to run native, then do the work that I need to do, then convert the file back so that a client can attach the virtual disk and keep on running.  I’ve got a great laptop setup and an even better desktop setup for running these virtualized environments.  Here are some notes outlining some simple ways (for me) to switch back and forth between these environments.

I basically use two different third party tools depending upon the exact need.  Both of these tools are extremely easy, self explanatory, and work very well.

WinImage is available at http://www.winimage.com/.  WinImage will convert between VHD and VMDK, but it does much more.  WinImage also has the benefit of being able to convert a ‘metal’ machine to a virtualized machine.  Any time I’m about to wipe a machine for good (laptop/desktop/server), I often will use WinImage to take a virtualized snapshot of the machine.  This allows me the option to either access the original drives or even relaunch the original machine if I’ve forgotten to get some critical info prior to formatting.  WinImage is a superb product!

StarWind V2V Converter is available at http://www.starwindsoftware.com/converter.  StarWind is a great tool for doing a sector by sector conversion between VHD and VMDK.

Now for some specifics…

“Convert Hyper-V to VMware” or “Convert VHD to VMDK”

This is the easiest scenario in an enterprise environment since the VMware ESX tools support importing VHD out of the box.  That doesn’t really help everyone that is running VMware Workstation on PC or VMware Fusion on a Mac.  Using either WinImage or StarWind has worked very well for all VHD to VMDK conversions that I’ve needed.

“Convert VMware to Hyper-V” or “Convert VMDK to VHD”

Microsoft System Center Virtual Machine Manager (VMM) also allows you to copy existing VMware virtual machines and create Hyper-V virtual machines. You can copy VMware virtual machines directly from an ESX Server host, in the VMM library, or on a Windows share. Although V2V is called a conversion, V2V is a read-only operation that does not delete or affect the original source virtual machine.  Details are at http://technet.microsoft.com/en-us/library/cc793147.aspx

Both WinImage and StarWind will also convert from VMDK to VHD.  I have had some odd issues with WinImage, but I’ve honestly never made the time to determine what the issues were.  It has happened two times in the past, and since then for this conversion I’ve just used StarWind.  I’ve found StarWind V2V Converter to be a rock solid, stable tool that works perfectly with conversion between Hyper-V and VMware Workstation and back.  However, in my experience, WinImage does create a smaller virtual drive during the conversion.

IMPORTANT: Prior to a conversion using either of these tools, you should (must?) uninstall VMware Tools on the guest OS prior to converting a VMDK to a VHD.  If you don’t, the virtual machine will not boot once you add it in Hyper-V.

“Convert VirtualBox to VMware” or “Convert VMDK to VMDK”

It’s funny that VirtualBox and VMware utilize the same extension for a virtual disk, VMDK.  This would lead one to assume that the virtual drive formats are the same, and that you could just interchangeably utilize either virtualization platform as desired.  The funny part is that sometimes you can!  The really funny part is that most of the time this doesn’t work for me!  Inevitably, I will attach VMware to a VirtualBox VMDK file, Windows will start to boot, and then it just stalls.  Sits forever and ever… never gives me an authentication screen.

The simplest way that I’ve found to migrate a virtual server from VirtualBox to VMware is to export the VirtualBox environment as an appliance.  VirtualBox allows you to Export the Appliance, which saves out a new VMDK file and an OVF file.  I then run a small batch file to launch the VMware Virtual Disk Manager command line application (comes with Workstation) to clean up, defrag, and shrink the disk prior to adding to VMware.

You could run each of these lines independently, but I find it easier to ‘set it and forget it’.  Some of these conversions take a while, and I’d rather not sit and watch progress reports.

vmware-vdiskmanager –r ExportedApplianceName.VMDK -t 0 NewDiskName.VMDK
vmware-vdiskmanager -d NewDiskName.VMDK
vmware-vdiskmanager -k NewDiskName.VMDK

For reference, the tags for disk manager used are:

-r : convert . Enter source path , disk type , output path
-d : defragment .Enter local path to vmdk
-k : shrink . Enter local path to vmdk

You may want to run the repair option if you aren’t able to open the VM after conversion.

-R : repair . Enter path to vmdk

By John Stover

John Stover Bio.

2 comments

  1. I would love to convert the MS HyperV SP2010 Demo virtual Machine to VMware Workstation 6.5. But the new VM has problems to start the operating system. Is there a restriction with the MS demo server HyperV? Any help would be appriciated 🙂
    thx

  2. Henry – there are no restrictions that I’ve ever seen on the MS provided demo virtual machines. I’ve even migrated some of these to VMware myself. I would try one of the 3rd party tools for the migration. I’ve had much better success with them! Good luck.

Leave a comment

Your email address will not be published.