From .vhd to .vdi
When I tried to run xp vhd, provided from microsoft, to test websites on multiple versions of IE (cf. How to test your website on IE6 & IE7 thanks to virtualization), it occurs that each .vhd file has been generated with the same UUID, preventing them from being loaded at the same time in VirtualBox (v2.2).
Although VirtualBox can now transparently handle .vhd natively, I chose to convert these .vhd files into .vdi format so that they have each a unique uuid and can be loaded at the same time in VirtualBox.
Below are the steps:
To do this, I proceeded as follow:
- install qemu package (sudo apt-get install qemu)
- convert .vhd file: qemu-img convert -O raw myfile.vhd myfile.bin
- once the file has been converted, we convert it to .vdi format using VBoxManage: VBoxManage convertfromraw myfile.bin myfile.vdi –variant standard
note1: “variant” is specified to ensure we have an expandable vdi file (.bin file is 17Gb, .vdi file will be only 1.5Gb)
note2: in previous version, “convertfromraw” command was called “convertdd”
That’s it.
Simply load your vdi file within VirtualBox, do it for all three xp .vhd files and you can now use all these VM more easily.
7 Comments: Trackback URL | Comments RSS
June 19th, 2009 at 2:12 pm
good job … thanks for sharing
more virtualbox stories http://www.geeksww.com/news/virtualization/virtualbox/
July 1st, 2009 at 4:10 am
As of VirtualBox 2.2.4, you can use the VBoxManage internalcommand “sethduuid” to modify the UUID of VHD files, eg
VBoxManage internalcommands sethduuid XPSP3withIE62008Dec.vhd
The VHD files don’t even need to registered with the Virtual Media Manager.
See http://www.virtualbox.org/ticket/3443
July 1st, 2009 at 9:13 am
great news! no need to convert any vhd file then => makes the entire process easier. Thx
March 21st, 2010 at 3:13 pm
nice work, well done &
thankyou
July 14th, 2010 at 12:05 pm
In the latest version of Virtual Box (v 3.2.4) you can use the clonehd command in vboxmanage to do this in one step. Just use the command like this:
vboxmanage clonehd myVHDimage.vhd newVDIimage.vdi -format vdi
This will create a new file, newVDIimage.vdi
August 14th, 2010 at 8:44 pm
I’ve try it but gave me this error:
Oracle VM VirtualBox Command Line Management Interface Version 3.2.8
(C) 2005-2010 Oracle Corporation
All rights reserved.
ERROR: code E_FAIL (0×80004005) – Unspecified error (extended info not available)
Context: “OpenHardDisk(src, AccessMode_ReadWrite, false, Bstr(“”), false, Bstr(“”), srcDisk.asOutParam())” at line 636 of file VBoxManageDisk.cpp
June 3rd, 2012 at 5:32 pm
Hi,
I followed your instructions.
I generated a vdi file, but when I start my vitual machine in virtualbox, I’ve got this message:
“Invalid magic number”.
Any help will be appreciated. Thx
8 Trackbacks