Virtual Machines: .vmdk to .vdi Using Qemu + vditool

VmWare to Virtual Box

View the Full Circle Magazine Version!

03/08/2007 Updated! Now there are informations on how to convert multiple vmdk disc images into a single .vdi disc image!

So you like Virtual Box and want to switch to this wonderfull Open Source software but you allready have a Vmware Virtual Machine you often use? Don’t worry, it is tricky but you can convert a Vmware virtual machine into one that will work on Virtual Box. Why this conversion is absolutelly convenient for you? Read my next post about How to Install Virtual Box and why you should do it.

So, everything is about the virtual disc image. There’s no need to convert the Virtual Machine into one for Virtual Box, once we’ve converted a .vmdk hard disc image (For VMWare) into a .vdi disc image (For VBox) we can just run VBox and create a new Virtual Machine similar to the one we had on VMWare.

First of all, download qemu, you can do it using Synaptic or simply opening a Console and executing:

sudo apt-get install qemu

And that’s the first step. Now open a console and go into the folder where you’ve got your .vmdk virtual disc image and type this:

qemu-img convert harddrive-name.vmdk -O raw-file.bin

Naturally, you’ll have to change harddrive-name with the name of your .vmdk file and raw-file with the name of the new converted file you want to create. After a few minutes, the conversion will be completed. Now we’ve got a raw hard disk image and we whant to transform it into a .vdi file!

Now we need a new application. You’ll find it here. Download it into the same dir where you’ve got your new raw .bin disc image file. The name of this app is vditool.

Downloading that vditool file is not the simplest thing in the world. If you try and open it with Firefox, for example, a strange page with weird code in it will appear. To save this vditool file, right click on the link and choose to save the file. You can also tell a download manager to download this file for you. I suggest you the download manager: Aria. It is into Ubuntu repositoryes.

Now that we’ve got vditool, we need to make it executable. Right click on the file, open its propertyes and set the “Executable” permission option. In Gnome, go into the Permission tag and activate the “Let this program be executed” or something like that option (Remember, my Ubuntu is Italian, dunno what’s your exact translation).

At that point, we’ll need the console again, from the same dir where you’ve stored dvitool and the .bin raw file. Run this from console into the interested dir:

LD_LIBRARY_PATH=/opt/VirtualBox* ./vditool DD new-file.vdi old-file.bin

Where new-file.vdi is the file that will be outputted by vdi tool and must be the first to appear in the command. The second filename, old-file.bin, is the name of the raw disc image we converted the .vmdk image to. Naturally, change this invented names with real ones.

If you wish, remember that you can run vditool for other tasks too. Now we’ll run it to optimize the filesize of the .vdi image file, for example. For a list of all commands, you’ve just got to execute vditool without any other option.

Now we’re going to optimize the filesize of the newly converted .dvi file, let’s call it new-file.dvi and fromth console in the dir where you’ve got this file, run:

LD_LIBRARY_PATH=/opt/VirtualBox* ./vditool SHRINK new-file.vdi

Now we’re all setted up. Let’s run Virtual Box. At this point, you have to create a new Virtual Machine, set it up as you like and choose the new-file.dvi as disc image. If everything is okay, the machine will run, even if it will have to be settep up again a bit from inside the OS you’re using. For example, Windows has got a lot of problems in this part.

When I started my old disc image converte into a new compressed .vdi file inside a new Virtual Machine created with VBox, WinXP refused to start. I had to insert in the CD-Rom my original WinXP Cd to boot from cd and restore the windows installation! Windows, this way, reconfigured and installed each new virtual peripheral so that at reboot everything was okay and all my programs where left installed where they were.

Multiple vmdk files to vdi

A lot of people have been asking me about this. I sincerely didn’t have a clue on how to convert multiple vmdk vmware virtual disc images into a vdi VB virtual disc image. Luckily, Leonardo Cosmai just provided us with a solution in one of the comments on this post! You can see that post for yourself.

What you have to do is:

1) Downloading and installing VMWare Server for your platform, it is freeware but proprietay software, it is opensourced but you’ll need to subscribe for a license to use it. We’ll just use this to convert multiplevmdk images into a single one. You can find VMWare Server here.

2) Run a terminal, move in the dir where you store your multiple vmdk disc images and run:

vmware-vdiskmanager -r source_multiples.vmdk -t 2 single_file.vmdk

And that’s all! The multiple vmdk images will be converted into one single vmdk image file. At that point you’ll be able to normally use this guide to convert the newly obtained vmdk disc image into a single .vdi file!

I sincerely hope this helped a lot of people out there. It is almost impossible to find a way to use vditool in Google for now. No matter how much you google, I spent the all day trying to find something. Thanks to the guys from the VBox IRC Channel for helping me out, I wasn’t going to get out from this problem alone. And a lot of people in Ubuntu Forum where in my same conditions, so…. Enjoy your migration to Virtual Box!


  1. Thank you VERY much for this. Like you said, Google is strangely useless for this problem. This was very helpful.

  2. there is an error, the right line is:
    qemu-img convert harddrive-name.vmdk -O raw raw-file.bin
    u miss the format

  3. @PiperLXP:
    Thank you for commenting. Aniway, you might be surprised to know that a correct line can be even of this kind:

    qemu-img convert harddrive-name.vmdk raw-file.bin

    without even the -o option! That is because qemu-img defaults the raw format if you ask for a conversion. Try it yourself 😉 It works very well without complains. Thanks for trying to help aniway! I can allways make mistakes, so, help’s appreciated.

  4. Thanks for posting this!
    Is there the other way round as well? I mean, converting a .vdi into a .vmdk? I have a virtual disk under vbox that I can’t get into the Virtual Disk Manager any more and I’d like to try the long way around with vmware…

  5. @Micha: Happy you found it useful, but sorry, I don’t know how to do the opposite process… and what is the problem you’re having with Virtual Box if I can ask?

  6. Nice work… is nice that the GNU community is always sharing their own experiences for the sake of others. Keep the good work and thxs u very much you make me a great favor writting down this post.

    Adrián Puente Z.

  7. Great howto, thanx! Does this tutorial also works for split .vmdk images?


  8. @Ch0ks: Thanks to you, people’s appreciation for my work is the best of all rewards :) I’m happy to do it and I always share the new knowledge I acquire with others in all the ways I can.

    @Heinzie: Thanks for the compliment but I have to say I don’t know how to split .vmdk images. I only have a single 2GB Windows XP licensed image, so I have no knowledge in this :(

    @Everyone: Look at the new feature! A lot of my articles will soon be available in the Full Circle Magazine version too! This versions of my articles are updated, much more indepth, filled with screenshots and even more simple to follow! For this post there’s a Full CIrcle Version already! Just click on the “View Full Circle Version!” you may find on the top of each of my articles. If an article hasn’t got that link already it means that it is either useless for the Ubuntu community or that I still have to work on a Full Circle version of it :)

    In the Full Circle WIKI Page you can also see on which articles I’m working wight now.

  9. For grabbing vditool, just type this at a bash shell:

    if you don’t have wget, you need it; type apt-get install wget

  10. Hey Michael, that’s a good idea indeed. Sorry, I didn’t think about it, since it’s a shell command and usually don’t use it to grab things from the net (I prefer graphical tools) then I didn’t think about it. Far better than having a code page in Firefox :)
    As long as you know that the downloaded file is in your Home directory..

  11. Thanx a lot !
    Very useful info

  12. Thanks for the link to vditool. Ironically, I stumbled upon your page from Google! I was looking for a way to shrink my vdi file and found this:

    Now I am going to check into converting vmhd into vdi. thanks again!

  13. Hi,

    Thanks for this nice post.

    Anybody knows how to convert a VMware image into a vbox image, if the vmware is made of multiple .vmdk files ?

    I don’t know, sorry. I wrote this post because at the time I needed to make such a conversion there where NO INFORMATIONS in google about how to make it. So I managed to solve it and then posted in my blog so that other people could find out how to do it and it looks like it worked. So, maybe NOW a lot of people may know how to convert a VMware image into a vbox image but I ensure you that when I posted this trick nobody new how to make it 😉

    So sorry fot not knowing how to convert multiple VMware images into multiple/single vbox images but that wasn’t a feature I needed or need.

  14. For multiple vmdk files, install the VMware Server then use:

    vmware-vdiskmanager -r source_multiples.vmdk -t 2 single_file.vmdk

    Now you have on single vmdk. 😉

  15. Thank you Leonardo, a lot of people where asking about this! Updating the guide :)

  16. Thank you for the Howto. I’ve run into a odd issue though, when attempting to run the vditool, I get a Permission denied error, yet I have full permissions. I have even run it as root with the same result. Any ideas as to the cause of this?

  17. Honestly not Sean, never had any problem of that kind :(
    You can find help here:
    I found all the informations necessary to build this guide asking on the irc channel, they’re very kind. In Firefox you can download an extension to run IRC directly into the web browser! Good luck and let me know how you solved it!

  18. Argh, I accidentally deleted a comment by Sean, he wrote:

    Okay finally figured it out. It turned out to be the noexec option in the mount options for the location I had the vditool and the files for converting. After correcting that, it now functions as needed.

    Sorry Sean it was an accident.
    So at the end it wasn’t an error related to vditools! I’m glad you solved it 😀

  19. What exactly did you do with the windows CD to Repair your install? I was successful up to the point of booting, but even in Safe mode it hangs. Using the repair mode from the windows CD, gives me a DOS-console, after which I do not know to proceed.


  20. @Micha

    LD_LIBRARY_PATH=/opt/VirtualBox* ./vditool COPYDD old-file.vdi new-file.bin


    qemu-img convert -f raw new-file.bin -O vmdk new-file.vmdk

  21. Just a note… English version of your ‘Let this program be executed’ is ‘Allow executing file as program’

    Thanks for the awesome guide!


    Just too sad that virtualbox uses different hardware virtualization than vmware and left my OS installation unusable.. but it works totally fine. Thank you very very much!

  23. (I mean that the process itself works totally fine; but my OS installation, inside the virtual disk, was screwed up; it was a mac osx tiger)

  24. I tried to do this with the Fedora DS virtual appliance, and when I do the convert it says 0 byte file

    [admin@localhost FDS]$ LD_LIBRARY_PATH=/usr/share/virtualbox/ /var/tmp/vditool DD FDS.vdi file.bin
    vditool Copyright (c) 2004-2005 InnoTek Systemberatung GmbH.

    Converting VDI: from DD image file=”file.bin” to file=”FDS.vdi”…
    Creating fixed image with size 0 Bytes…
    The operation completed successfully!
    Writing data…

    Of course then the job fails with out of space. So, it may not work for all images.

  25. Pingback: » Blog Archive » daily

  26. @JKnight – As far as the Windows repair process, you have to skip the first repair option and go for the second that is available. I believe the first option should be responded to as continuing with the install as normal. Then there will be a second option to repair.

    I realize that comment was five months ago, but others may have the same question

  27. People using Ubuntu could use:

    LD_LIBRARY_PATH=/usr/lib/virtualbox/ /usr/lib/virtualbox/vditool DD dd_winxp.vdi dd_windows

    where dd_windows is a dd image or a ntfsclone image.

  28. hmm and ive go this ( gentoo FWIW)

    localhost VirtualBox # pwd
    localhost VirtualBox # ls -la |grep vditool
    -rwxrwxrwx 1 skimanbob root 20884 2008-02-09 18:42 vditool
    localhost VirtualBox # ls -la |grep ^B
    localhost VirtualBox # ls -la |grep
    -rw-rw-rw- 1 root root 527152 2008-02-08 15:36
    localhost VirtualBox # ls -la |grep vditool
    -rwxrwxrwx 1 skimanbob root 20884 2008-02-09 18:42 vditool
    localhost VirtualBox # ./vditool DD winXP.vdi /tmp/winXP.bin
    ./vditool: error while loading shared libraries: cannot open shared object file: No such file or directory
    localhost VirtualBox #

  29. I have the exact same error as the person before me:

    ./vditool: error while loading shared libraries: cannot open shared object file: No such file or directory

  30. the error means that the path to the shared library (object) isn’t “/usr/share/virtualbox”.

    Try ‘/usr/lib/virtualbox/’, or ‘export LD_LIBRARY_PATH=`find / -name | head -n1`’

  31. @Cole – I’m further behind than you were, but you are right.
    The first repair option is the “Recovery Console” which is a command line environment. Very hard to work in.

    If JKnight selects the option to install Windows, he should be offered the opportunity to “Repair an Existing Windows Installation”. It will list the available installations.

    If the previous installation has problems that do not allow the Installation CD to find it, he may not get the choice to repair it.
    Then he will have to use the “Recovery Console” to resurrect the previous installation enough for the CD to recognize it & offer the Repair Option.
    These Microsoft articles will help you to get the previous XP env to be recognized by the Windows installation process.
    Q307545 & Q309531. You can find the article with a google search.

    hope this helps some one down the road.

  32. Pingback: Howto convert from VMware to VirtualBox - EDV | Ende der Vernunft

  33. This is a very good thread. I have a question: I have .vmx files from my Vmware Fusion images. So, can qemu convert these to .vdi as well?


  34. Pingback: Converting .vmdk to a .vdi image. « BOT-TRONIX

  35. When i run qemu-img convert harddrive-name.vmdk -O raw-file.bin with my file names it just sits there…the cursor moves one line down and then sits. I let it run for 12 hours (over night and all day) and nothing just stting there. Has anyone else had this? am I doing something wrong…Please help!


  36. When your Windows-Guest VMware image hangs after you converted it to the VirtualBox format, try setting the “IO APIC” Option in the machine options. That worked for me, so no need to re-install.

  37. Ga.. does not work getting the following error after running vditool:
    $LD_LIBRARY_PATH=/opt/VirtualBox* ./vditool DD new-file.vdi old-file.bin
    ./vditool: error while loading shared libraries: cannot open shared object file: No such file or directory

  38. There s a much easier way to do the conversion, that requires less playing with different utilities and can be easily done on any platform, not just Linux. The idea is simple. First, download the CloneZilla live CD.

    In VirtualBox, create an empty vdi hard drive that has the same size as the original vmdk.

    Then set up a new VirtualBox machine that will load from the CD with clonezilla and has two hard drives. The first one should correspond to the vmdk, the second – to vdi (for safety it makes sense to have a backup of original vmdk at this point, because you may occationally copy the empty vdi into vmdk).

    Load the machine and follow the simple UI of CloneZilla to make a full copy of the original vmdk drive into vdi.

    That’s it. You may then use the vdi file and get rid of the vmdk.

    Hope this helps.

  39. Good overview. Please note that vditool is giving a 404; according to VirtualBox, they have incorporated (most) of the functions into VBoxManage, so the command would be like:
    VBoxManage convertdd Windoze.bin Windoze.vdi

  40. Pointing out a correction to a really old entry, but it is still relevant. In comment #3, PiperLXP had pointed out an error in the invocation to vditool. But your reply missed the point entirely.
    You have written the command for coversion as:

    qemu-img convert harddrive-name.vmdk -O raw-file.bin

    This is not correct. Either put “-O raw raw-file.bin”, or remove “-O” completely. The command as you have put it is incorrect.

  41. Pingback: Top 12 referrers for Q1 2009 « Share Virtual Machines

  42. Pingback: Top 10 referrers for Q1 2009 « Share Virtual Machines

  43. Molto interesante,cose da vedere.

  44. Pingback: Thought Flux » exporting vmware images to virtualbox

  45. Hi folks,

    Would it be possible to convert KVM to VirtualBox runngin qemu-ing? If yes please advise how to do it. Thanks

    Furthermore can we only convert selected VMs on KVM to VirtualBox instead of converting all its VMs to the latter and deleting those VMs not needed afterwards.


  46. wget only reply that the file is not available, does any one knows where to locate it ?

  47. Hello,

    I’ve just read the qemu-img command help (just type ‘qemu-img’), and the command seems to be a LOT easier than everything you said.

    The syntax is :
    qemu-img convert -O [output format] [input file] [output file]

    For your example, it gives :
    qemu-img convert -O vdi image.vmdk image.vdi

    If you wish to convert vdi into vmdk, just type :
    qemu-img convert -O vmdk image.vdi image.vmdk

    I mean, there is no need to go through a raw file or vditool… qemu-img does everything.

    Well, maybe I missed something…

    • Excuse me for the double post, but here are the supported formats (still given by the help command) :
      cow qcow vdi vmdk cloop dmg bochs vpc vvfat qcow2 parallels nbd host_cdrom host_floppy host_device raw tftp ftps ftp https http

  48. Pingback: Konvertieren eines VMWare- in ein Virtualbox-Image | DaRaFF's Blog

  49. This post, “Virtual Machines: .vmdk to .vdi Using Qemu + vditool | Il Pozzo Oscuro” was in fact
    great. I’m creating out a replicate to show my personal colleagues.
    Many thanks-Kristal

Leave a Reply