convert .vhd (VirtualPc) files into .vdi (VirtualBox) files

[UPDATE]: now virtualbox natively support .vhd files => you might be interested in reading this post: convert .vhd (virtualpc) file to .vdi (virtualbox) format

.vhd files works with VirtualPc (Windows) whereas .vdi files works with VirtualBox (Linux, GPL in “ose” version) => we need to convert them in order to use .vhd files.

I wanted to load VirtualPc (.vhd) files to load windows XP vhd files made available on microsoft.com

  1. I downloaded requested .vhd files
  2. Problem is .vhd format is for VirtualPc, whereas VirtualBox has its own format (.vdi) therefore we need to transform them. Doing this is a 4-step process:
    1. download qemu-img from http://www.nongnu.org/qemu/download.html or directly download .rpm file (http://rpmfind.net/linux/rpm2html/search.php?query=qemu-img)
    2. transform .rpm into .deb and install it: fakeroot alien -d –scripts qemu-img*.rpm; sudo dpkg -i qemu-img*.deb
    3. transform .vhd file into raw file: qemu-img convert -O raw XP_SP2_with_IE6.vhd XP_SP2_with_IE6.bin
    4. then transform .bin file into .vid format using vboxmanage (included into virtualbox-ose package): vboxmanage convertdd XP_SP2_with_IE6.bin XP_SP2_with_IE6.vdi
  3. you can run virtualbox-ose and mount your newly created .vdi file (it worked for me at least!). Very great solution (except it takes 16Gb per .dvi file), thanks microsoft, I hope it will go beyond Sept, 9th, 2008 (.vhd expiration date)

sources

14 Comments: Trackback URL | Comments RSS

  1. none Says:

    try
    VBoxManage modifyvdi XP_SP2_with_IE6.vdi compact
    to shrink the virtualbox image

  2. Fred Says:

    Just so you know it’s against the EULA to do this. So, proceed at your own risk.

  3. remy Says:

    Fred, thanks for your warning.
    I tried to find more information but could not find against which end-user license agreement (EULA) it goes against. If it’s for running windows in a virtual machine, I don’t think so since I used versions delivered by microsoft itself, with limited lifetime (sthg like 1 month) which they said themselves was free to use.
    If it’s for converting one file format into another, I did not find anything into EULA.

    In any case, you’re right to put a warning. if you have more detailed information, feel free to share!

  4. Martin Kalén Says:

    From §1 of the VPC_EULA.txt of an XP SP3 + IE7 testing appliance:

    “You may install and use one copy of the software on your device of which you are running a validly licensed copy of Microsoft Virtual PC or Microsoft Virtual Server. You may not change or convert the virtual hard disk image from the VHD format.”

    Your guide contains excellent generic instructions for converting a dynamic sized VHD to VDI-format which in itself is perfectly legal. Why don’t you just “generify” some filenames?

    On a side note, it seems that VBoxManage would have been able to do the conversion in a one-shot operation if the VHD had been fixed size:
    VBoxManage convertdd fixeddisk.vhd fixeddisk.vdi

  5. remy Says:

    Hi Martin, thanks for sharing the information!
    Indeed it’s against Microsoft EULA to do this, so if you do it, make it at your own risk.

    I’ll try to abstract the post a bit more
    ++ Remy

  6. antiban Says:

    big thanks!!

  7. fuckthecaptcha Says:

    It’s against EULA to use it at all without valid Windows license.

    Microsoft wants you to use it only with their own virtualisation products, which in turn have EULAs forbidding use of non-Windows hosts.

  8. geek Says:

    The url for qemu has changed – redo the hyperlink!

  9. remy Says:

    thx, I’ve updated it.

  10. ld Says:

    Thanks for the helpful hints here.

    With Ubuntu 9.10 you can install QEMU directly from Ubuntu Software Center. Above instruction needs to change a bit to show “VBoxManage” for the non-OSE instead of “vboxmanage” which seems to be part of OSE edition.

    I did this with VBox 3.1.4 and so far looks good.

  11. kossmoss Says:

    Thanks, your solution helped me to run the Virtual PC image on my Debian

  12. handmug45 Says:

    Good info. I was having some troubles and found which converts .vhd, .vmdk, .vdi, or .hdd to any of these formats. Free for non-commercial use.

  13. Daniel Sant ana Says:

    What about windows?
    How can i convert this VHDs to VDI on Windows w2k8 ?

  14. jaume mila Says:

    Great!!
    Thank you, it SOLVED my headache, I’ve got this error:
    “Could not open the medium ‘/path_to/my_image.vhd’. VD: error VERR_VD_VHD_INVALID_HEADER opening image file ‘/path_to/my_image.vhd’ (VERR_VD_VHD_INVALID_HEADER)”.

    I want add that my host is an Ubuntu 11.10 Oneiric and I’ve installed qemu so:
    “sudo apt-get install qemu”

Post a Comment

Your email is never published nor shared. You're allow to say what you want...

Powered by sweet Captcha