7

I am looking at transforming a VMDK hard drive into a VHD (Virtual Hard Drive). The VMDK comes from an export of our VMware machines and I want to try importing it into Azure.

Any idea how this would be achieved ? I tried a variety of small tools out there to try to move between the 2 formats, to no avail so far. Most tools declare the VMDK invalid in some way.

migrated from stackoverflow.com Oct 5 '12 at 8:31

This question came from our site for professional and enthusiast programmers.

11

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'll try it out again. I also don't have Hyper-V installed, is that step really required ? – Antoine Toulme Dec 8 '12 at 0:01
5

There has been an update to the tool to convert a .vmdk to a .vhdk.

Microsoft Virtual Machine Converter 2.0 was released around April of 2014.

Here is the link to the tool: Microsoft Virtual Machine Converter 2.0

The new tool changes the way to convert from using MVDC.exe to using a powershell cmdlet.

I followed this excellent blog to figure this out. What's new on Microsoft Virtual Machine Converter 2.0

Here is a detalied summary of how to do it.

The default install location is:

C:\Program Files\Microsoft Virtual Machine Converter

Using powershell as a local admin you can then load the cmdlet:

Import-Module .\MvmcCmdlet.psd1

After the cmdlet is loaded you can call the following:

ConvertTo-MvmcVirtualHardDisk

This will ask for the .vmdk file path:

Supply values for the following parameters:

SourceLiteralPath: D:\some.vmdk

It will then start the conversion and place the .vhdk in the following path after its converted:

C:\Program Files\Microsoft Virtual Machine Converter

I hope this helps someone else.

  • 2
    Just tried and got an error: ConvertTo-MvmcVirtualHardDisk : The entry f49019ba is not a supported disk database entry for the descriptor. At line:1 char:1 + ConvertTo-MvmcVirtualHardDisk + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (Microsoft.Accel...nversionService:D riveConversionService) [ConvertTo-MvmcVirtualHardDisk], VmdkDescriptorPars eException + FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdle t.Commands.ConvertToMvmcVirtualHardDiskCommand ConvertTo-MvmcVirtualHardDisk : One or more errors occurred. – Antoine Toulme Jul 22 '14 at 22:37
  • Based on the error it looks like something could be wrong with your source .vmdk. I just converted 2 other .vmdks with no issues. Here is one I just converted yesterday following those instructions. bitnami.com/stack/ghost/virtual-machine – ElvisLives Jul 23 '14 at 15:08
  • It might be the vmdk version we use is older and incompatible. I know it works well in VirtualBox and Fusion. – Antoine Toulme Jul 23 '14 at 18:46
  • For those getting the same error as @AntoineToulme it can be solved: tool:members.ozemail.com.au/~nulifetv/freezip/freeware/dsfok.zip dsfo.exe "E:\Win10Prev\preview Windows 10 x64.vmdk" 512 1024 descriptor.txt add # to line: ddb.toolsInstallType = "1" dsfi.exe "E:\Win10Prev\preview Windows 10 x64.vmdk" 512 1024 descriptor.txt – user5389726598465 Nov 25 '18 at 23:53
4

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!

0

I have used the tool suggest by rkosegi and it did converted by VMDK to VHD and I could use locally. With regard to your "Invalid vmdk file" error, this could be specific to the VMDK you have as not everyone using this tool report same error.

Based on my experience on using converted VMDK on Windows azure, what I found is that not all VHDs which are converted from VMDK will work on Windows Azure. There were few problems reported after VHD was installed with Windows Azure Integrated components and deployed to Windows Azure.

So to get best experience, it would be best if you generate your OS VHD native and then deployed to Windows Azure. And if you start creating your native VHD directly, you will be sure that it will run on Windows Azure as expected.

  • Thanks for the help! I looked but it doesn't seem to be possible to create the VHD from vCenter. Would you happen to know how that would be done ? – Antoine Toulme Oct 3 '12 at 18:16
  • 2
    The "tool" link is broken. – Tarnay Kálmán Aug 15 '13 at 18:36
0

The answers by @ElvisLives and @AvkashChauhan are good, but for those that are not scared of using the powershell this is a great solution.

  1. First you will need to download and install Microsoft Virtual Machine Converter 3.0 from Microsoft’s website.
  2. Next, open an elevated PowerShell prompt and run these commands (changing the paths to match your source VMDK file and destination path of your new VHD file):

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

    -ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath “C:\Ubuntu-disk1.vmdk” -DestinationLiteralPath “C:\Ubuntu-disk1.vhd” -VhdType FixedHardDisk -VhdFormat Vhd


When doing it like this no need for RDP

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.