Convert Virtualbox .vdi to VMware .vmdk
I love VirtualBox because is fast and without a lot overhead. But network bridging is kind of pain in the ass with VirtualBox . I hope they change this fast. Anyways I had to convert my VirtualBox images to the VMware file format. This is easily done with qemu-img a nice tool bundled with qemu. It can handle serveral file formats:
Supported format: qcow2 vvfat vpc bochs dmg cloop vmdk qcow host_device raw
So you could convert some other stuff too. Converting is easily done (this example is for Windows by using qemu-0.9.0-windows):
qemu-img.exe convert -O vmdk hdd.vdi hdd.vmdk
In this case we convert the disk hdd.vdi to hdd.vmdk. The input format is detected automatically but can be overriden by adding -f switch. Output is vmdk as given with the -O switch.
March 14th, 2008 at 6:04 pm
finally! someone describes how to get from vdi to vmdk and not the other way round like most howtos out there. thx alot
March 17th, 2008 at 8:11 pm
Yeah, needed this for a special brigding setup which I wasn’t able to create with VirtualBox. Glad to help
March 31st, 2008 at 10:58 am
Thanks you very much for your post ! I’m in the process of migrating some images…right now everything runs fine and smoothly.
(I’m gonna check if you have some other good readings)
March 31st, 2008 at 12:53 pm
A lot swiss people visiting lately
April 18th, 2008 at 3:43 pm
Thanks a lot for this handy tip. I have almost got VirtualBox working just as I want it, with Vista host and Ubuntu guest, but have also got stuck on the network bridging – I want a web server on the guest to be visible to the outside world and I just can’t seem to get this to happen. It’s absolutely straightforward in VMWare though, which may tempt me back, hence my interest in the conversion. I wish they’d sort this out.
April 18th, 2008 at 4:37 pm
There is a possibility to get bridging working with VirtualBox. You simply create a new hostinterface. Open network, select both your new hostinterface and your real nic, rightclick and select create network brigde. A so called Microsoft Network Bridge is created and your VM will be visible to the outside world. Unfortunately it is not possible to create another bridge so I was forced to use VMware which resulted in this article
May 1st, 2008 at 1:32 pm
Actually, I managed to get bridging working with VirtualBox, just as you said. And unless I’ve missed something, I believe you don’t need to create other bridges for further VMs, you add the new host interfaces to the existing bridge. This works for me anyway – I have two VMs running under VirtualBox, both of which are reachable from the outside.
May 2nd, 2008 at 12:59 pm
Yeah, but I wanted to have one bridge for my wired NIC and the other for my wireless NIC so I can put the one machine into another network. With VMware this is very easy to accomplish but with VirtualBox I found no way…
May 20th, 2008 at 4:40 am
Great. I managed to convert my virtualbox vdi to vmdk. However the vmdk file can’t be used in vmplayer although I create a vmx by easyvmx.
May 20th, 2008 at 1:27 pm
Is there any message regarding the vmdk? I’m courious
May 20th, 2008 at 3:46 pm
Good tip, helped me move my Windows VM running on virtualbox under Ubuntu, to my new Mac with VMWare Fusion.
Much appreciated.
May 27th, 2008 at 5:29 pm
I’ve tried converting a couple of .vdi images as indicated above. Everything seemed to complete w/o error. However, when I connect the new .vmdk image to a new virtual machine, it is unable to find a boot device. Any suggestions?
May 31st, 2008 at 3:53 am
The qemu-img by itself did not create a bootable windows system. Here’s how I got it to work:
Here’s how I did it (using Linux)
1. Get vditool (http://www.virtualbox.org/download/testcase/vditool, will need VirtualBox installed, plus a few other things like libstdc++-5.0, libuuid, etc.)
2. Get qemu-img (from qemu binary http://bellard.org/qemu/qemu-0.9.1-i386.tar.gz)
3. vditool COPYDD diskname.vdi diskname.dd
4. qemu-img convert -O vmdk diskname.dd diskname.vmdk
Then I was able to boot the image.
May 31st, 2008 at 9:29 pm
Hey greg, thanks for the nice trick! BR Chris
June 1st, 2008 at 2:29 am
Can’t thank you enough for taking the time out to write this.
You saving people loads of time!
June 17th, 2008 at 5:24 am
I followed what greg said to do and im still unable to play the resulting vmdk in vmware player. says line 1: syntax error. any ideas?
July 14th, 2008 at 10:11 am
Tip if you use windows: The QEMU binary does not support large files. You might install Cygwin to use the linux version of qemu.
August 19th, 2008 at 4:56 pm
FINALLY YEAH
wooooooooooow there were only this fuckign crappy bitchy gay ass vditool tutorials out there which had damaged *.dll’s … so thnkx a loooootz!
August 20th, 2008 at 8:04 pm
hey guys, i’m know nothing about computers so help will be greatly appreciated. I using max os x and I need to convert my .vdi from virtual box to .vdmk to use on vmware. How do i do this on a mac? Do i use Q? Does anyone know how to use this on Q, i can’t even figure out how to use Q =( help! thanks
August 20th, 2008 at 8:08 pm
Hi Jenny, don’t know Q only from Star Trek. But take a look at comment #13 from Greg. He describes the conversion using Linux. Check out http://www.kju-app.org/. There you should find a Mac port of Qemu. Good luck!
August 20th, 2008 at 8:11 pm
Ahh now I get it. kju. Stupid I
August 21st, 2008 at 7:11 am
ahhh i can’t seem to get it to convert correctly. So i couldn’t figure out how to convert it in mac os x so i did it on a windows xp using mvware. I copied the .vdi to the windows xp harddrive. I was able to convert it to .dd using vditool but then when i tried to convert to .vdmk using qemu-img it game me an error: error while writing. Does anyone know why this is?
it gives me the same error if i try to convert .vdi directly to .vdmk (w/o using vditool) and also when i convert .img to .vdmk (i converted to raw image using vditool). It gives me the same error at the same spot of writing because the files are all the same size
after spending a whole day on this…i think i’ve given up….
August 21st, 2008 at 8:52 am
Hey Jenny, could you tell us what error comes up?
August 21st, 2008 at 6:17 pm
so i typed qemu-img.exe convert -O dmk dd-hdd.dd vdmk-hdd.vdmk
and then after vdmk-hdd.vdmk grows to about 2gb the command prompt says:
qemu-img:error while writing
thinking about it some more after a night a sleep, do you think its because there’s not enough space? there’s plenty of space on my mac harddrive but i think because i’m using mvware, I set the max of the virtual disk to be 20gb. hmm any ideas?
thanks for the help
jen
August 21st, 2008 at 6:26 pm
Hi Jen, so on which box you’re running the qemu-img.exe command? On your mac or on a Windows box? Strange very strange. Maybe you can contact me by mail (cp AT peterschen.de) so we can sort out this mess.
August 21st, 2008 at 6:34 pm
oops sorry for all the typos
its qemu-img.exe convert -O vmdk dd-hdd.dd vdmk-hdd.vmdk
i tried it with like 5.5 gb of space left
it always creates files exactly the same size, so i don’t think its a space issue?
jen
September 24th, 2008 at 12:22 am
Thanks for the info – the qemu command works well on my Mac
A question though. Any ideas on how to get the resultant vmdk to boot within a VMWare Fusion 2.0 VM? I’ve added it as the only hard disk and checked the BIOS settings (boot from hard drive first) but as soon as the VM starts it tries to boot from the network?
September 24th, 2008 at 3:21 am
Sorry
ignore my question – just read greg’s post above…
September 24th, 2008 at 3:53 am
Sorry to spam the comments but I thought those with a Mac might be interested in this.
The vditool that greg mentioned is the Linux version and unfortunately the latest version of VirtualBox (2.0.2) for the Mac does not include it
A new tool VBoxManage allows you to compress a raw image but not decompress – which is what you need to do to convert a VDI to a VMDK.
Anyway I found an old version of the open source edition (1.5.5Pre1) available as an installable package which also includes an uninstall tool. This version has vditool
See http://ciderhouse.opal.ne.jp/wp/english/virtualbox_e/
Once installed (last step will fail but doesn’t matter) open a terminal and go to /Applications/VirtualBoxOSE.app/Contents/MacOS
Anyway – hope this helps the Mac users
September 24th, 2008 at 9:28 am
Thanks for your input Kevin. Now this post is quite the howto on *.vdi to *.vmdk for Windows, Linux and Mac. Thanks to you guys!
October 7th, 2008 at 1:01 am
Network Bridging with VBox
Not sure how deeply you guys will have dug into the guts when trying to make Vbox bridging work. The key issue is that under VMWare the underlying config for bridges is handled by VMWare Server itself during the install, whereas with VBox nothing is preconfigured inside Box – so one has to do some work on the host machine configs to get it all to work as expected.
On a windows box, install VBox; then create a new vmachine as normal, select NAT for its network properties. Boot and complete install as normal. Then shut it down. Go to vbox network properties for the new guest and create [add] a new tapi virtual host interface for the first [or any other] virtual adapter.
Switch from the vbox config to the host machine and open up My Network Places, properties, multi-select the new Virtual Box connector AND your existing LAN connection, right click and use the option to create a bridge. It’s usually a good idea to tick the option to display the connection on the taskbar.
Now go back to VBox and once again select the network properties for the new guest and reset from NAT to Host Interface with the Virtual Box Host Interface N highlighted. Save and restart your guest and it should now be able to bridge correctly to the NIC on the host machine.
For Suse and similar ‘nix boxen see http://searchservervirtualization.techtarget.com/tip/0,,sid94_gci1303344,00.html for detailed instructions – I /think/ [with slight variations] these instructions may also work on a Mac but I don’t have a machine to hand to test it right now.
Hope this helps.
Robert
October 7th, 2008 at 9:13 am
Hi Robert, thanks for your insights. I always did it like this. Problem what I faced at some point was that I can only create one MAC bridge in Windows. With VMware for instance I can assign two external networks by adding my wired and wireless NIC to the machine.
This was the reason why this post exists in the first place
BR
Chris
October 17th, 2008 at 4:58 pm
A piece of advice : do not forget to SHUTDOWN completly the VirtualBox VM before creating the vmdk, or your saved state will be corrupted (it happened to me).
October 19th, 2008 at 8:12 am
Hi @all,
i have the same issue like Jennifer in post 26. Error Message:qemu-img: error while writing. 71 gb free disk space. The size of the file is allways 2.147.483.648 Bytes.
(dos box, Windows XP SP3 german)
any solution?
thanks in further
October 22nd, 2008 at 8:38 pm
Hi all,
The “error while writing” problem is because of Windows binaries limitation :
http://www.robertpeaslee.com/index.php/qemu-img-error-while-writing/
November 20th, 2008 at 2:28 pm
Thanks
December 18th, 2008 at 1:30 am
Hello everyone,
I just converted a vdi to a vmdk file. Apparently without errors.
I used vmware a long time ago and don’t remember the details. I tried running VMPlayer and try to use the vmdk file but got this error:
Error opening virtual machine XP.vmdk: File “/home/alejandro/vmware/XP.vmdk” line 1: Syntax error.
Do I need to create a virtual machine and later on add the hard drive file?? Or is this a conversion error?
Sorry for the newbie question..
Thanx a lot
December 18th, 2008 at 8:11 pm
Hi All,
I’ve found this really interesting especially being a relatively new convert to xVM VirtualBox following the considerable growth in size of VMWare Server 2!
Like some of the posts I too had issue with the conversion failing consistently at around 2GB with the error even though I had over 200TB of free local disk space:
qemu-img:error while writing
As suggested by Alex I read in a numbers of places that this was down to a limitation with the Windows libraries used to compile the source so as opposed to compile it myself I opted to use Qemu on Linux, my Fedora10 VM.
I shared my local disk (as “data”) with appropriate permissons and from my Fedora box:
>mkdir /mnt/winshare
>mount -t cifs -o username=mrweale //192.168.0.2/data /mnt/winshare
Enter password when prompted
I then installed Qemu by simply using yum:
>yum install Qemu
…and then used qemu as suggested initially:
>qemu-img convert -O vmdk /mnt/winshare/Fedora10.vdi /mnt/winshare/Fedora10.vmdk
I watched happily as the new vmdk file grew >2GB and qemu finished without any errors.
I then installed VMWare Server 2 (to test) and created a new VM and pointed it to my new vmdk ensuring that I used IDE0:Device0 as VirtualBox does not provide SCSI support. My VM doesn’t boot, it tries to boot from CD and then PXE only to return the error:
“Operating System not found”
I’ve tried changing the IDE and Device number but it still won’t boot. Before I start messing around with reinstalling GRUB and such like can anybody tell me if I’m doing anything silly?
By the way v2.1.0 of VirtualBox (17th Dec 2008) now has full support for VMDK/VHD files, including snapshots!
Thanks,
Matt
December 19th, 2008 at 9:05 pm
[...] from VirtualBox .vdi to VMWare .vmdk formats [...]
January 1st, 2009 at 5:20 am
[...] use snapshots. I haven’t tried either method. It apparently is also possible to go from VirtualBox to Workstation using [...]
January 4th, 2009 at 2:39 am
[...] A bit of googling led me to this page: http://www.xgrr.de/wordpress/2008/02/25/convert-virtualbox-vdi-to-vmware-vmdk [...]
January 4th, 2009 at 2:43 am
Got the conversion working on a Mac, but had to parse through multiple comments to figure out all the right steps.
I’ve written up all the steps for Mac users on my blog (http://www.jerelabs.com/wordpress/2009/01/converting-virtualbox-images-to-vmware-images-on-the-mac/) and posted them below:
1. Obtain Q (http://www.kju-app.org/)
2. Obtain VirtualBox OSE 1.55 Pre 1: http://ciderhouse.opal.ne.jp/wp/english/virtualbox_e/. Do this even if you have a copy of VirtualBox installed. You’ll need a tool in here that is no longer provided.
3. Open up a terminal window and navigate to /Applications/VirtualBoxOSE.app/Contents/MacOS
4. Execute the following command: “vditool COPYDD [File Name].vdi [File Name].dd”
5. Go back to the terminal window and navigate to /Applications/Q.app/Contents/MacOS
6. Execute the following command: “qemu-image convert vmdk [File Name].dd [File Name].vmdk
After you complete those steps, you’ll be all set to create a new Virtual Machine using the .vmdk file as your hard drive. VMWare Fusion will likely warn you about the file being in a legacy format, but it will let you convert the file to the newest format.
When starting the VM for the first time I ran into a bit of a problem, it wanted me to reactivate Windows since the hardware had changed (not a big deal), however I had no keyboard or mouse input. I rebooted the VM a couple of times and all was fine. I don’t know why that worked, but it did.
January 16th, 2009 at 11:38 am
Thanks for your input. I guess now we have a really good step by step how-to on this topic. Statistics confirms that. VMware keywords hitting the roof. Great!
February 20th, 2009 at 12:03 pm
Thanks for the Ideas, but there is good news now!!!!
It is much easier with the new VirtualBox (I used the Mac-Version 2.1.4)
You can now change the vdi-Format to vmdk with a tool provided by virtualbox.
I actually did this on a mac osx leopard, and it came up in VMWare with no problems!
Just use the Command VBoxManage like this:
VBoxManage clonehd /vboxdata/old.vdi /vmwaredata/new.vmdk -format VMDK
The old vdi-File must be an active installed VirtualBox-Volume.
Have fun,
mafnred
February 27th, 2009 at 4:42 pm
In Mac OS X, you can convert your vdi image without installing anything more:
/Applications/VirtualBox.app/Contents/MacOS/VBoxManage clonehd HardDisks/YOURDISK.vdi -format VMDK YOURDISK.vmdk
The only odd thing is that VBoxManage will preprend /Users/LOGIN/Library/VirtualBox/ to your source disk path…
March 26th, 2009 at 12:50 pm
I’ve tried qemu-img on Win32 but it has a >2GB issue (when target format is VMDK — raw target format doesn’t exhibit this problem, but neither can it be used for VMWare), so it’s no good
I tried ‘VirtualBox vboxmanage clonehd …’ but the VMDKs it produces make VMWare crash (some disk-related assertion).
Eventually, what worked is this:
1. Create the desired VMDK in VMWare,
2. Add it to your VirtualBox machine,
3. Boot your VirtualBox machine — assuming it’s running Windows,
4. Install the free EASEUS Partition Master [http://www.partition-tool.com/download.htm]
5. Use the Partition Master’s Disk Copy utility and follow the instructions (will require a reboot).
6. Shutdown the VirtualBox and use the resulting HDD in VMWare.
Note: If you’re using the same opportunity to enlarge the HDD (which is also something Partition Master can do for you), you might run into a problem booting Windows XP from the new HDD — a “A disk read error occurred Press Ctrl + Alt + Del to restart” might appear upon booting. This has nothing to do with VDI-to-VMDK copying, but take note. I’ve enlarged a 2GB HDD into a 10GB one, and the resulting disk had this program.
The solution: Use Roadkil’s Boot Builder [http://www.roadkil.net/program.php?ProgramID=3] to change the number of heads to 255 on the new HDD (make sure you know what you’re doing, edit the new HDD, not the original one). The new HDD should now work on Windows.
March 31st, 2009 at 11:57 pm
For anyone on Linux, take a look at VBoxManage before you go and setup qemu
P.S.: I’m only setting myself up on VMPlayer for the mostly working DirectX9 support – sorry, VBox’s mostly-broken solution with Wine3D isn’t working well enough for me.
April 3rd, 2009 at 2:50 pm
Dear All,
It is probubly not the right place, but I am desperatley searching for VirtualBox Windows binaries.
I would very much like to try VirtualBox OSE under WinXP but unfortunately do not have Visual Studio to compile it myself. Does anybody know where is it possible to download windows binaries of VirtualBox OSE ?
Thanks a lot in advance,
Alex
April 8th, 2009 at 7:51 am
Here’s a quick script I threw together that will do it. You need to have free space on the partition in which your /tmp directory exists equal to the size of the full disk (including 0-blocks). That is, if you create a 15GB vdi and allocate on the fly, but are only using 4 GB (the rest is free space), you need 15 GB on /tmp. This uses an undocumented feature of VBoxManage, so I can’t guarantee it will work on all future versions.
Requirements: Linux or cygwin, qemu installed, virtualbox installed, bash (this script is simple enough that /bin/sh would probably work).
Simply create an execute script file with the following:
#!/bin/bash
echo Converting VDI Image to Raw Image…
RawImage=`mktemp`
VBoxManage internalcommands converttoraw “$1″ “$RawImage”
echo Converting Raw Image to VMDK Image…
qemu-img “$RawImage” -O vmdk “$2″
echo Cleaning up temporary files (raw image)…
rm “$RawImage”
the “internalcommands” part converts the VDI to a raw image, stored in a temp file. The qemu-img command converts the temp raw image to a vmdk. The resulting vmdk image is condensed, so it should be close to the size of the original vdi image. The script then deletes the temporary image.
April 8th, 2009 at 7:55 am
Oh, one more thing; how to use the script:
vdi2vmdk source.vdi dest.vmdk
Note that it seems that qemu-img likes to be in the working directory of the destination, so if the directories are different, run:
cd /path/to/dest
vdi2vmdk /path/to/source.vdi desk.vmdk
June 4th, 2009 at 2:47 pm
Things have moved on this might be easy now.
With VirtualBox 2.2.2 you can export your machine as an Appliance using the Open Virtualization Format (OVF)
The VMWare vCenter Converter 4.0.1 (free download) imports OVF Appliances.
I am just exporting my VM from VirtualBox at the moment to see if it works “like it says on the tin”
June 4th, 2009 at 2:54 pm
Nice. Keep us posted. At the time when I wrote this tutorial this was not possible but I guess a lot changed in the meantime.
June 4th, 2009 at 4:45 pm
Exported the OVK file okay from VirtualBox but VMWare converter crashes on my PC when I try to import it. Agghhh did seemed to simple to be true.
There is an option in VMWare converter to import an existing (running) machine, I think it might be possible to point it at your running VirtualBox VM. Hopefully it would not be able to tell it is not a physical machine.
Another option for Windows guest OS, would be to run the VMConvertor on the guest and get it to convert the local machine. I didn’t have enough free disk space on my VM to attempt this option.
June 8th, 2009 at 9:31 am
Posted a question to Twitter about OVF on VMWare, got this page as a response.
It is an OVF import/ export tool from VMWare might be worth a look.
http://twurl.nl/yhnv7g
June 8th, 2009 at 4:23 pm
Apparently VirtualBox OVF files are not quite standard, the VMWare OVF tool forum has a newly created thread on converting them.
http://twurl.nl/gqxcc0
August 14th, 2009 at 5:47 am
Wonderful article. I been looking for one on a similar note. I guess you always have something up your sleeve.
October 27th, 2009 at 5:18 pm
It’s quite useful
Thank you!
November 27th, 2009 at 8:05 am
The method posted here doesn’t work. I too got: “Operating System not found”.
If you want to convert .vdi to .vmdk, you have to transcode .vdi file to .raw format using vboxmanage.
Everything’s explained here:
http://www.liucougar.net/blog/archives/118
November 27th, 2009 at 2:41 pm
Hi Marek1721,
The initial method is not a 100% true. But if you read the comments closely you’ll find out that the issue is already addressed. Anyhoo, thanks for your link!
Cheers
Chris
March 25th, 2010 at 8:58 pm
Unfortunately, this method creates blank VMDK only. I managed to convert VDI to VMDK and it is working fine in VMware Player. Check my post here
http://www.sysprobs.com/convert-vdi-vmdk-open-sun-virtualbox-virtual-machine-vmware-player-workstation
April 3rd, 2010 at 4:55 pm
[...] burn any format video to DVD and copy DVD in super fast speed with high quality. When you copy DVD,xgrr.de the whole not the half | Convert Virtualbox .vdi to …Exported the OVK file okay from VirtualBox but VMWare converter crashes on my PC when I try to [...]
May 27th, 2010 at 3:36 pm
At 2GB converted it brokes up, “qemu-img: error while writeing” – virtualbox isn’t any solution.