Convert VDI to VMDK & Open Sun VirtualBox Virtual Machine in VMware Player & Workstation

vdi-to-vmdkThis post explains how to convert vdi to vmdk and open Sun VirtualBox virtual machine in to VMware workstation or VMplayer 3. As you are aware, Virtual Box uses VDI as hard disk file and VMware uses VMDK.  Opening VMDK in VirtualBox is very straight forward since VirtualBox supports VMDK. But opening VDI files in VMware workstation or VMware player is not possible, because VMware doesn’t support VDI files.

After I wrote steps to convert VMDK to VDI and How to open VMDK files in Sun VirtualBox, I wanted to try converting VDI to VMDK. When I googled , found only few steps   work with Linux or Mac environment and didn’t work for me in Windows.

Found the two following posts in google first page, but both did not work for me. I’m sure it wouldn’t have worked for others too.

How to convert VDI to VMDK; Converting a VirtualBox image to a VMware disk image and vice versa

how to convert vdi to vmdk in Sun VirtualBox Vbox

So, after several attempts, here are the steps worked for me in converting VDI to VMDK in Windows environment and allowed to open VirtualBox virtual machine in VMware Workstation and player.

Before convert VDI to VMDK, make sure to delete snapshots in VirtualBox. Because each snapshot keeps different hard disk files separately from major disk file. So if you convert the major VDI file to VMDK then you will get the first version of virtual machine before any snapshots. There for we have to merge all snapshots to major disk file to get the latest virtual machine in VMware. By deleting snapshots you can merge all snapshot hard disks to main hard disk file.

Read more about deleting snapshots in VirtualBox 3.1 under branched snapshots.

Steps to Convert VDI to VMDK

1) Convert VDI file to RAW format by Vboxmanage command.

Vboxmanage internalcommands converttoraw <VDI File> <filename.raw>

VDI to VMDK

In this example I have WinXP.vdi at G:\VirtualBox location. You must add path to Windows OS to work this vboxmanage and qemu-img commands.  Read more about setting up these commands paths in Windows which is explained in VMDK to VDI.

2) Once RAW disk is created, now we can convert RAW to VMDK. For this conversion you need third party software QEMU Manager for Windows which can be download here.

VDI to VMDK

3) After installed QEMU Manager for Windows, start the conversion of RAW to VMDK by following command.

Qemu-img convert -O vmdk <Raw File> <VMDK file.vmdk>

VDI to VMDK

4) VMDK file will be stored at the location you specified in command. This VMDK file is containing the same data which VirtualBox VDI file had.

VDI to VMDK

5) Now we will import this VMDK file in to VMware Player 3 and run the same virtual machine which was running in Sun VirtualBox.

When people wanted to change virtual machines between VirtualBox and VMware, they try to convert VMX to XML or XML to VMX. It’s wrong.  You cannot convert virtual machines by converting these files. VMX is a virtual machine configuration file on VMware and XML is for Sun VirtualBox. We must convert the hard disk files (VMDK or VDI) to be able to swap virtual machines.

Then how about VMX and XML? We have to create them. When you create virtual machines in VMware or VirtualBox it creates theses configuration files automatically. So do not waste your time to convert VMX to XML or XML to VMX.

6) To import converted VMDK files to VMware player, just create a new Windows XP virtual machine. You have to create same OS of VDI file. In this example I converted Windows XP VirtualBox virtual machine.  I’m assuming that you know the steps to create Windows XP virtual machine in VMware Player 3, so I’m not going to explain it.

Before start the virtual machine, remove the newly added hard disk during the creation and add the converted VMDK ( VMXP.vmdk) as a hard disk.

7) That’s it. Play the virtual machine. Now, you must be able to see the same Sun VirtualBox virtual machine in VMware Player. You may have to allow drivers installation, because VMware and Sun VirtualBox desktop virtualization software are totally different.

Remove VirtualBox additions if it’s installed and install VMware tools.

I’m attaching the screen shots of same virtual machine in Sun VirtualBox and VMware Player 3.

VDI to VMDK

VDI to VMDK desktop virtualization

This method not only to transfer virtual machines to VMware from VirtualBox, but also to access VirtualBox VDI files in VMware products.

The similar method can be used to convert VDI to VMDK and open in VMware Workstation.

I hope this post will be useful to convert VirtualBox VDI files to VMware VMDK files in Windows environment and transfer virtual machines between top desktop virtualization software.

Let me know if you face any problem on this VDI to VMDK conversion.

Comments

  1. pavithren says

    Thanks for the info. Now I can convert between the two formats seamlessly when I move around.

  2. says

    This is wonderful. It also works great under Mac OS X Snow Leopard!
    You just need to install Q first which is Qemu for Mac OS X.

    Open Terminal app

    Type the following to get to your VirtualBox HardDisk files:

    cd ~/Library/VirtualBox/HardDisks

    Convert VDI file to RAW format as this article showed (above):

    vboxmanage internalcommands convertoraw nameofsystem.vdi nameofsystem.raw

    Type the path to the qemu-img command that is in the Q app with the arguments to perform the conversion from the VirtualBox HardDisk folder that you are already in:

    /Applications/Q.app/Contents/MacOS/qemu-img convert -O vmdk nameofsystem.raw nameofsystem.vmdk

    Open Fusion, and if it is Fusion 3, when you create your VM using the converted disk, it will tell you that the vmdk file was made with an older version of vmware and asks you to let Fusion convert it.

    Worked great!

  3. Aaron Farmer says

    I was just curious why you didn’t use the command:
    >vboxmanage clonehd xpdisk.vdi xpdisk.vmdk –format VMDK –variant standard –type normal –remember
    and do the whole conversion in one easy step?

    Aaron

    • Kooh says

      Aaron I hope you can help me out. The only options I’m seeing with clonehd are:

      [--format VDI|VMDK|VHD|RAW|]
      [--variant Standard,Fixed,Split2G,Stream,ESX]
      [--existing]

      I used

      $VBoxManage clonehd win7.vdi win7.vmdk –format VMDK –variant Standard

      and successfully converted the VDI to VMDK; however when I open VMWare to either Import or Open the virtual machine, both win7.vdi and win7.vmdk are greyed out and I am unable to choose either one. Any ideas on why VMWare won’t recognize this VMDK? I also did the same as above with Fedora 14 with the same results. Thank you.

      • Kooh says

        NEVERMIND! I just realized that rather than trying to “Import” or “Open” the virtual HD, you need to act as if you are installing a fresh copy (I actually stumbled upon this by accident when I gave up on win7 and decided to do a fresh install of 2008 Server lol).

        So sysadmins, to recap: If your VMWare seems to not recognize your freshly converted VMDK, it may be because you are trying to Import/Open, when instead you should go to “Home>Install Windows or another operating system in a new virtual machine.”

  4. bob says

    Aaron your a gem. Your solution works perfectlyand is quick with no fuss. Thank you. As to why others don’t do it it’s probably because they don’t know all the commands available at the console for virtualbox. Either way, your solution is the best and most direct – you have saved me a lot of pain – thank you

    • says

      @Aaron and @bob,
      Thanks for your comments.
      The same command Aaron said created empty VMDK which did nothing on VMware for me. But I’m sure I would have done something wrongly. ;)
      Cheers.

  5. Wolf says

    You don’t even have to get QEMU. Just do this:

    VBoxManage internalcommands converthd -srcformat vdi -dstformat vmdk

  6. Ashketchum22NL says

    my progress gets stuck at the part of converting it with Qemu…
    every time i do that it converts to a file of 4,2GB and then starts over again to 0KB when i reload the map in explorer.
    in the end i get nothing more than a 4.2GB .vmdk file when i cancel it and its not even usable for vmware workstation 7

    does anyone have a solution?
    Greets

    Ash

  7. says

    I found this new option ..
    trying it out
    Vboxmanage internalcommands
    converthd [-srcformat VDI|VMDK|VHD|RAW]
    [-dstformat VDI|VMDK|VHD|RAW]

    converts hard disk images between formats

  8. DRK says

    Hi.
    Sorry if this seems out of place.
    I have a *.vdi image.
    I don’t have VBox.
    Can I convert from *.vdi to *.vmdk with out VBox?

    • Dhruv says

      Hi, sorry this is going to sound dumb, but can someone point out the exact steps for opening the VMDK in VM Player? I’ve converted over from VDI using clonehd. Then went into VM Player -> Create New Virtual Machine and chose “I will install operating system later”. Then chose Windows Server 2008. Now I’m stuck…

      Thanks in advance for pointing me in the right direction!
      Dhruv

  9. Rium says

    I just successfully migrated my virtualbox vm to vmware player uses the steps outlined in the comments above:

    1. do “VBoxManage.exe clonehd existing-vdi-file.vdi new-vmdk-file.vmdk –format VMDK”
    2. create a new vm in VMWare Player and select the options to install the OS later. Create a dummy virtual hard drive with this new vm.
    3. after the new vm is created, go to Virtual Machine Settings and remove the dummy virtual drive, and then add your new vmdk virtual hard drive.
    4. now boot it up and you should be good to go.

    I tried a few different things from other posts I read, but this is what worked for me.

    thanks!

    Rium

  10. omsun kumar says

    sir i am in big trouble i was having a win 7 VM ……….one day my system crashes ……….. i have the vdi file of win 7 but i cannot use it ………….as you said that fo conversion vdi to vmdk i need to merge snapshot………… is there any alternative way

  11. says

    this is one way to do it but if youre on linux and this might work for Windows too but you can just do…

    vboxmanage internalcommands clonehd vdifile.vdi vmdkfile.vmdk

    its a few less steps.