VMDK to VDI in Windows

This article explains how you can convert vmdk to vdi in windows environment.  Vmdk is default disk file format in Desktop virtualization software VMware workstation and vdi is in sun VirtualBox.
There are some articles on internet about doing the same steps in Linux or sun environment. This method explains how to convert vmdk e to vdi file format in windows environment.

vmdk to vdi

I recommend two ways for vmdk to vdi

1)      It’s not required to convert vmdk to vdi to open your VMware workstation guest operating systems on VirtualBox, because VirtualBox supports VMware vmdk file as hard disk file.

Vmdk file can be added to sun VirtualBox media manager very easily. Check my earlier post on how to open vmdk file in sun VirtualBox.

After successfully added vmdk file to VirtualBox media manager. You can boot  OS from vmdk file by following steps;

Create a new virtual machine in virtual box with correct operating system. Instead of creating a new hard disk, select the existing vmdk disk file . That’s it, boot the OS. Do not worry about vmx file which is having VMware virtual machine configuration only. Vmx file only required for VMware.

This is the first step to use vmdk file in VirtualBox without converting to vdi format. Let’s go to second step.

2)      This step to convert vmdk file to vdi physically in windows environment. Some extra works to be done to archive this.

Twice we have to convert files to get vdi file.

Vmdk  –>raw  –>vdi

To convert vmdk file to raw format, we require third party software called QEMU manager. Download the latest version of QEMU manager here for Windows

Install it. We will not be using the GUI version of software.

Let’s say, I’m going to convert new Google chrome OS vmdk file to vdi format.
So first we will convert vmdk to raw format by following command.

vmdk to vdi

-O ( Capital O)

Above command created raw file (.bin) at specified location.

vmdk to vdi

(Don’t bother about VLC media file format)

QEMU manager’s part is completed with vmdk to raw file conversion.

Now we will use VirtualBox command to convert this raw file (.bin) to vdi format.

Use following command to convert,

Vboxmanage convertfromraw  <raw file location>  <vdi file location>

vmdk to vdi

If all correct, without any error message you can see vdi file in destination.

Desktop virtualization software

Then, simply you can use this vdi in sun VirtualBox media manager (also you can vmdk files in VirtualBox media manager)

These are the easy steps to convert vmdk file to vdi file in windows environment.

If you want to use qemu-img or vboxmanage commands in windows computer anywhere, I mean not from the program location, you can add the paths of these commands in ‘ Environment Variables’ under system properties.

Just for easy reference, see below picture.

Desktop virtualization software

I’m expecting to hear your comments and problems in this vmdk to vdi conversion.

Comments

  1. kini says

    Excellent tut, this was exactly what I was looking for.

    Just a small additional note regarding the path settings.
    The method above adds the path to both programs permanently – if you just need this once, you can as well add the paths in your command window, valid for this one cmd session only:
    just use the good old set command
    set path=%path%;full_path_to_qemu-img;full_path_to_vboxmanage
    e.g. set path=%path%;c:\program files\qemumanager\qemu;c:\program files\sun\virtualbox
    When in doubt whether this worked or not, just display the updated path settings with path

  2. Shakoor says

    Hi Dinesh,

    Good tutorial. I have one problem though.When I start the VM in VirtualBox, I get the error;

    Error Loading Operating System

    Any ideas?

    Thanks

  3. Leon says

    Hi thanks for the tutorial.

    I was wondering, why would i convert from .vmdk to .vdi when VirtualBox can run .vmdk directly? Is it faster, better, saver, more stable? Thanks again.

    • alip says

      I had problems with VMDK (this was an image made of a Vista laptop that died on me). After Windows updates or using Control Panel’s add/remove programs I’d get registry errors* during restart and the VM wouldn’t boot. After converting the image to VDI, no such problems so far.

      * (c0000218 {Registry File Failure} The registry cannot load the hive (file): \SystemRoot\System32\Config\SOFTWARE or its log or alternate. It is corrupt, absent, or not writable)

  4. Will says

    Tyvm for the tutorial!

    I use W7 Home Premium and it was a bit of a challenge to get it the commands to work from the command prompt, but after half an hour of moving stuff around using only the keyboard (my mouse batteries died right after I downloaded Qemu): success!! \o/

    Initially, I tried adding the “qemu-img” and “vboxmanage” commands to the path file, as detailed above, but I still had to run them from their respective folders via the command prompt to get them to work. Perhaps I need to restart my computer for it to take effect? *shrug*

    In any case, thanks again for the tutorial! It saved me a few hours of having to recreate a virtual machine from scratch!

  5. Will says

    After reading the previously posted comments, I feel the need to type more…

    @ Leon –

    As an example:

    I needed to make a few copies of a particular virtual machine (made using VMware Workstation, but running in VirtualBox) for school-related reasons. Let’s call it “vm1″.

    I have a program that provides a GUI (and CLI) for copying virtual machines. (Check it out!)

    However, the aforementioned program could not copy vm1 (due to some sort of compression or something). With the above tutorial though, I was able to quickly (relative to installing 2-3 more operating systems in Vbox) convert the file and beginning the copying process without error.

  6. Domenico says

    Thank you for your guide, but in my PC doesn’t work.

    In VirtualBox environment, I run the converted VDI hard disk and nothing happens…….like you run the VDMK hard disk before the conversion.
    Could you help me?

    ps: eventually, sorry for my english

  7. Domenico says

    @Dinesh
    Thanks for your reply, but…….it doesn’t work.
    I tried the follow solutions:
    1) VDMK to IDE
    2) VDMK to SATA
    3) converted VDI to IDE
    4) converted VDI to SATA

    I really would like to know, why do they say that VirtualBox is fully compatible with VDMK if it isn’t true?

    I think…..and I hope…..I don’t do anything wrong because the GUI is very simple and clear

    Thank you again!

    • says

      @Domenico,
      VMDK is compatible with VirtualBox, but I’m not sure whether i can add ‘ Fully’ in this sentence.

      Just tell me something clearly, when booting from VMDK what’s happening? are you getting blue screen error in Windows guest OS? Did you manage to add VMDK to Virtual media manager successfully? I meant, is it detecting the correct disk size?

      I’m hoping you are not trying this with any snapshot VMDK files, which will not work.

      If you are doing all correct but still problem in booting, then you have boot from Windows OS CD and repair the disk. ( Overwrite boot sector, MBR..etc)

  8. Domenico says

    @Dinesh

    I haven’t got a “blue screen”.
    Yes, it’s detected with his correct size.
    I didn’t use a snapshot, but I use a VM created with the tool “VMware converter” that, naturally, works fine with the “VMware player”(I think that this information it’s not very important).

    Simply…..I start the virtual Machine and I never see anything, only a black screen with a cursor at the upper-left of the screen.

    Another thing……after I close the VM with the click on the X of the window, the second time I start the VM i can see the list that tell me to choice if I want to start windows normally, safe mode, without network, etc…
    But whatever I choice the result is the same.

    I will follow your advice and I will try to fix the problem with the WinXP CD.

    I let you know!

    Many thanks!

    • alex says

      to fix thw problem of no os found you have to go to setting in the virtualbox ox the win xp remove scsi controller and add the xp pro to the ide . i had the same problem when i used the packaging tool in the vmware to convert vmware disk to ovf file

  9. Reg says

    GREAT work, thanks a LOT !!!

    It works for me, I am experimenting with Vista with the expectation of running my current laptop (virtualised) in a much larger machine when I upgrade (4 times the disk, 4 times the bogomips, etc.).

    My trials have been with a 200 Gig image of the C and D drives, so obviously I haven’t had room to create .vmdk > bin > .vdi files on the same hard drive – and I suspect that an insane loop might appear at some point if I tried to (.image(.image(.image))) etc.
    So I am going out to an external USB 2 terabyte drive for this.
    A few rough numbers;
    Creating the .vmdk file takes about 3 hours.
    Converting the .vmdk to .bin takes about 4 hours.
    Converting .bin to .vdi takes 4 1/2 to 5 hours (unclear, I went to bed).

    Booting Vista in a virtual machine within Vista is painfully slow from USB 2
    Once booted and migrated into physical memory performance is acceptable for most of what I do.

    A couple of minor problems;
    The wall clock lost about 3 hours last night.
    My audio device Conexant couldn’t get set up by the guest additions software.
    On settings > control panel > system there was an indication that Windows Vista was not activated and at some point a comment that said it would be automatically activated in 3 days.
    I am guessing that there is a licensing issue here with the physical hardware not being “seen” by the license management enforcer – or whatever that nonsense is called.

    I should add that working from the converted .vdi file seems to be more stable than the “direct” .vmdk file. This may be coincidental, since I have only done this conversion once and it was from a different .vmdk. Since I still have the .vmdk .bin and .vdi files around I should do some more trials to see if there is performance and stability differences between .vmdk and .vdi

    That is about it for me, thanks again for a GREAT piece of work.

  10. Reg says

    Domenico,
    I only just got into this group, so I’m a bit late in replying to your posts.

    It looks very much like some symptoms I had on my first runs.
    The default in VirtualBox when creating a new virtual machine is ONE processor, but many/most of our newer machines have 2 or more.
    Loading a .vmdk file that was created from a running 2 processor Vista into a VirtualBox virtual machine with ONE processor did cause blue and sometimes black screens for me on a (physical) AMD Turion X2.

    The other thing I have had minor issues with is adding hard disks in virtualbox, it seems I can only add them in the sequence that virtualbox decides, so if I want ONLY the most recently added one I have to add them all until I get that one and then remove all the others.
    That is the other thing that has blown up here, having .vmdk and .vdi files of the same image attached to the same virtual machine when I try to boot it – a VERY BAD IDEA (-:

  11. Domenico says

    @ Reg,

    Thank you for your suggestion, but I did it with VmWare player because i spent too much time to try to find a solution.

    However, I can tell you that I converted a one core Celeron PC(4 years old), so…..I think this isn’t the problem.

    Thanks again!

    Domenico

  12. zeddock says

    One commenter asked if there is benefit to converting to VDI from VMDK.

    Any comments on if it is, and why?

    Thanx for the tutorial and additional expertise.

    Zeddock

  13. says

    I’m having the same issues as Dinesh notes above. Had installed VMware player just a few days ago and found all the new services it installed bogging down my high end Win 7 (64bit) box. Just found VirtualBox and the install went fine. Selected my working XP .vmdk image and just get the black window error “Error loading operating system”. Added disk controller SATA (default was wrong). Still no joy. Stopped all the active VMware services, no help. The web site link will show my PC configuration (HDW and OS).

    Would like to try this before going the file conversion if I can.
    Help!

    • Fulton says

      I just booted my host and now I’m getting the same error on my VMware Player. Can’t load the XP OS. So I guess the image just got corrupted. Great, it only took 3 hours to setup the XP box the way I wanted it.

      • Fulton says

        OK, so I figure I would just byte the bullet and create a new native HD for Vbox. It all seems to happen OK until I try to load the XP OS. I can’t get Vbox to boot from the CD. I have the boot sequence right. Any suggestions?

  14. zeddock says

    Are you confident in your CD? Perhaps it is not good?

    I created an ISO image of mine (known good) and mapped that image as a drive for the new machine. That worked for me.

    Good luck.
    zeddock

    • Fulton says

      OK, so I reinstalled VirtualBOX and created a native HD file. Now I have XP running in it OK. BUT, I’ve not found a good way to transfer files from the host (Win 7) to the virtual client (XP). I tried to create a share on a directory but with no luck. I also tried to use a USB stick but Vbox doesn’t see it. These are odd as my keyboard and mouse are both USB and work but my printer and other USB devices are not. Also I was able to create shares into my big IBM system (AS/400) OK. VMware Player just let me drag and drop from my Win 7 desktop to my virtual desktop. I thought Vbox supported cut and paste, haven’t had that work either. I don’t want to have to do something like install an FTP server on Vbpx to get files over to it.

      • Fulton says

        I got it. Had to install guest additions. Now I have a shared folder on my host that the client can see.

        • Fulton says

          OK the shared folder is working.

          The clipboard is still not working. I have it set to both ways. When I ‘copy’ on one side I don’t get ‘paste’ on the other.

          BUT I can’t get a USB thumb drive on the host to be seen on the vbox. I have the filter set and the USB when in the virt machine I pulldown and select the USB device to have it checked I get this error: Failed to attach USB device Unknown device to the virtual machine VirtXP. XP should know this this USB stick without a custom driver. I’ve tried a couple of different thumb drivers.

          Result Code:
          E_INVALIDARG (0x80070057)
          Component:
          HostUSBDevice
          Interface:
          IHostUSBDevice {173b4b44-d268-4334-a00d-b6521c9a740a}
          Callee:
          IConsole {515e8e8d-f932-4d8e-9f32-79a52aead882}

  15. Fulton says

    Does anyone know where to get the SATA driver for Win XP for the PCI storage device V-box creates?

  16. says

    I also had difficulty in getting Qemu to work. I’m running Bodhi, so also tried to use remastersys, in order to export my ‘live’ running system to *.iso. I’m not convinced it will work properly as an iso, & I’m also concerned the resultant iso wont boot from DVD media.

    I may just forget about it, because I can’t get the shared folders to work, either. If I create a new iso from my image, at least I can try a proper boot into actual hardware, rather than virtualising the OS. I had spent ages cutomising Bodhi as well.

    Thanks for the information. Great tutorial.

  17. us4711 says

    Well, I had to backup my productive system Win7 prof 32bit GERMAN, as there was a need to reinstall that machine.
    I found the ‘VMware vCenter Converter Standalone Client’ which allowed me to create a .vmdk image of the currently running machine (you have to assign an NTFS-formatted drive as the source, as otherwise the target image will be splitted into pices < 2GB related to the restrictions of FAT32)
    The image consists of the hidden Win7-volume, and the system-drive C:\.
    After that, I converted the vmdk-image to .vdi with the vboxmanage.exe, which is part of VIRTUALBOX 4.1.4r74291. I created a file called convert.cmd with that content:

    "drive:\path\vboxmanage.exe" clonehd -format vdi "drive:\path\source.vmdk" "drive:\path\destination.vdi"

    I HAD to include the quotation marks EXACTLY as shown, otherwise the command wouldn't work.

    After creating an new virtual machine, everything worked from scratch.

    On the first run, I had to confirm some driver- and temp-file-location related messages. The second run showed me an nice and smooth running system.

  18. PerfMonk says

    Hi,

    I have used the “vmware center converter standalone client” to create a vmdk from my physical window xp machine. Then I did skip the step with qemu to do directly: “VBoxManage clonehd source.vmdk dest.vdi –format vdi”. It worked no problem, then I created a virtual machine with virtual box using the vdi disk just created (NB it is important to specify “IO APIC” in the motherboard configuration.

    It works very well but I have one problem I can’t pinpoint. I cannot use more than one cpu for the machine. I have an intel core i5 laptop and it has 4 core. If I set more than one cpu, the VM doesn’t start at all and give this error message:


    Unknown error creating VM (VERR_VMX_MSR_LOCKED_OR_DISABLED).

    Code d’erreur :
    NS_ERROR_FAILURE (0x80004005)
    Composant :
    Console
    Interface :
    IConsole {515e8e8d-f932-4d8e-9f32-79a52aead882}

    If I run only one CPU it run ok. And yes I have enabled IO-APIC.

    My laptop is actually dual boot with the physical XP machine and a Linux Mint Debian Edition. I made a physical to virtual with the vmware converter. Is it possible there is a restriction from the vmware utility that allow only one CPU ? I have check hardware driver on the XP virtual machine and it says it is an “Intel COre i5 cpu M520 @2.40GHz.
    The driver is intelppm.sys. Is it possible that vmware installed a modify version of intelppm.sys that would allow only one CPU to work ? I will try to reinstall the driver from my windows CD.

    Anybody had this problem ? Any clues on how to solve this ?

    I would really like to use at least 2 CPU for my vm… With only one it is rather slow.

    Regards,

    Bernard Tremblay
    Quebec city, Qc, Canada

  19. Markus says

    Hi!
    Thanx for the good artcile.

    But if you, like me, get this error while converting from vmdk to raw;
    “qemu-img: error while reading”
    you need to convert it to with the VMWare disk manager first:
    vmware-vdiskmanager -r disk1.vmdk -t 0 disk2.vmdk

    Then use the qemu-img and it should finish without that error.

    BR,
    Markus