Page 1 of 2

Convert VPC to VBox?

Posted: 12. Feb 2008, 17:38
by David McKenna
Paul Smedley has a new Virtual Box build up that contains (among other
things) a conversion utility (Qemu-img.exe) that will convert VirtualPC .vhd containers to VirtualBox .vdi.
When I try to run it against my VirtualPC WinXP container, I get a 'file read
error' right when it gets to 2GB. My VirtualPC container actually consists of
4 seperate files, each at most 2GB in size, so I am guessing the utility
fails because it wants one big file (not multiple segments).

Does anyone know if it is possible to connect these 4 files into one large
container - and if so how?

TIA,

Dave McKenna

Re: Convert VPC to VBox?

Posted: 14. Feb 2008, 00:50
by Yoda
David McKenna wrote:Paul Smedley has a new Virtual Box build up that contains (among other
things) a conversion utility (Qemu-img.exe) that will convert VirtualPC .vhd containers to VirtualBox .vdi.
When I try to run it against my VirtualPC WinXP container, I get a 'file read
error' right when it gets to 2GB. My VirtualPC container actually consists of
4 seperate files, each at most 2GB in size, so I am guessing the utility
fails because it wants one big file (not multiple segments).

Does anyone know if it is possible to connect these 4 files into one large
container - and if so how?
I have no idea, if that can be done - I only tested smaller vhd's.

Maybe just wait for next official Virtualbox version - I've heard it should have support for reading vhd's directly.

Posted: 14. Feb 2008, 08:22
by Technologov
>I've heard it should have support for reading vhd's directly.

I haven't heard anything like this.

Fixing split VHD files

Posted: 30. Mar 2008, 01:57
by StarNamer
A spliy .VHD file (i.e. one with multiple segments) is just that. So they can be made into a single file just by copying. That is...

COPY X.VHD+X.V01+X.V02+X.V03 Y.VHD

should work. There's a blog from a guy who works for microsoft where this was discussed. Search for "Virtual PC Guy".

Posted: 31. Mar 2008, 22:24
by David McKenna
Y'know... I thought of that and tried it, but it didn't seem to work - I would always just get a file ~4k in size (when it should have been about 8GB).

Your post jogged my memory (sometimes dangerous) and I remember that OS/2's command interpreter is 16 bit and may not be able to handle this task. I then vaguely remembered that there was a 3rd party 32 bit command interpreter out there and was able to find it and install. Sure enough this allowed me to create the one large container. Even better, I was able to boot it using VirtualPC! I then removed the VPC extensions and shut it down.

I was also able to convert this file using the command:

Qemu-img.exe convert WinXP.vhd -O vmdk WinXP.vdi

but the bad news is I can not seem to start the new VDI file with VirtualBox - I get an 'Invalid BOOT.INI file' message followed by 'Windows could not start because the following file is missing or corrupt: <windows root>\system32\hal.dll'. So now I'm stuck.

Anyone have any ideas?

Posted: 1. Apr 2008, 05:03
by David McKenna
OK... I've gotten farther now. I had to convert my VirtualPC Windows XP disk image to 'fixed-size', then install the 'MergeIDE' package (in VPC) mentioned at http://www.virtualbox.org/wiki/Migrate_Windows.

Then I used qemu-img to convert to vmdk format. This file booted in VirtualBox with all kinds of complaints about having to re-validate Windows - which I did. After re-booting, it seems to work, but I get all kinds of 'Delayed write failed' warnings. I installed the Guest additions - it took two tries because of the write errors - and after reboot, they were installed, but I can not get screen resolution and size settings to stick. After reboot Windows always starts in 640x480 mode - very annoying. I can set to a larger res with no problem, but it doesn't stick with the next boot.

Could be the vmdk container format needs work? Any insights would be appreciated....

Posted: 1. Apr 2008, 06:56
by David McKenna
Alright... I finally got it nailed down. I had to convert the vmdk file to a raw image using qemu-img, then convert that to a .vdi image using VBoxManager. Now the WinXP virtual machine runs just fine using the .vdi image.

I guess I should have converted the original .vdh file to a raw image in the first place....

Re: Fixing split VHD files

Posted: 11. Apr 2008, 00:09
by magog96
StarNamer wrote:A spliy .VHD file (i.e. one with multiple segments) is just that. So they can be made into a single file just by copying. That is...

COPY X.VHD+X.V01+X.V02+X.V03 Y.VHD

should work. There's a blog from a guy who works for microsoft where this was discussed. Search for "Virtual PC Guy".
You need CMD (4OS2 doesn't work = no large file support) and you have to use the /B (for binary) parameter:
COPY X.VHD+X.V01+X.V02+X.V03 Y.VHD /B

Re: Fixing split VHD files

Posted: 15. Apr 2008, 03:24
by David McKenna
magog96 wrote:You need CMD (4OS2 doesn't work = no large file support) and you have to use the /B (for binary) parameter:
COPY X.VHD+X.V01+X.V02+X.V03 Y.VHD /B
I tried that but it didn't work. What DID work however was COPY /B X.vhd+X.v01+X.v02+X.v03 Y.vhd... I had forgotten about the switches on the COPY command.... thanks for reminding.

Posted: 24. May 2008, 07:58
by jep
Hello,

Another thing...

If you come across a large vhd file that has the option "dynamically extended" set you can use winimage (0.8.1) to make it fixed, then use qemu-img in eComStation to convert it directly to a vmdk file.

To use WinImage you need Odin installed, I tested with a version from 25 of August 2006. The fun part is that it created the 16,4 Gb large fixed disk quite fast too. No 2 Gb limit there! :D

Note: qemu-img for windows doesn't seem to be able to convert the file directly to vmdk, as it can't handle ouput of vmdk-files over 2 Gb. You need to convert it to a raw image first, then use vboxmanage to convert that to a vdi-file and comact it in the last step. Just as mentioned in previous posts here.

//Jan-Erik

greatful for the work put into VirtualBox and qemu-img!

Converting VHD to Virtual Box

Posted: 21. Jul 2008, 01:54
by Virtual11
Dear David McKenna
Could you please post step by step instructions as to how you converted vhd to virtualbox format, I am running solaris 10 on Sun fire x4150, very new to Solaris/unix.

My VHD is above 16 GB in size and I have second vhd for data/applications etc, which is 15 GB in size.

Thanks in advance.

Posted: 21. Jul 2008, 02:58
by TerryE
Gosh, this all sounds very fraught to me!!! If I had to convert a VHD to a VDI, I would do it in two stages VHD->VMDK->VDI.

Surely the best tool to do the first step is VMware Converter which is a downloadable command line tool from VMware (be careful to create the right version of VMDK).

The way to convert from VMDK -> VDI is to download a Clonezilla LiveCD. Create a VM with this as your boot DVD, your VMDK as (hd1) and a blank VDI of the same size as (hd0). When you start up this VM clone-zilla just sees /dev/hda and /dev/hdb. It isn't aware that they are different type. Now you just clone hdb->hda.

Use dynamic VDIs because clonezilla does the copy sequentially anyway.

Or am I being thick here?

Now you have the bare VDI (or VDIs if you repeat this). You still have to get up to the usual games with the MergeIDE, NT kernel tweaks and DMI variables, but this is to do with P2V not VHD->VDI.

Posted: 12. Nov 2008, 02:33
by boardtc
I have a windows .vhd XP installation I would like to convert to use in virtual box. Can't find about Qemu-img.exe or the steps needed to convert....are they straighforward?

Posted: 12. Nov 2008, 03:08
by TerryE
Hi and welcome to our forum. You might want to take this opportunity to browse the Forum Posting Guide. This contains some useful tips on how to search for VBox knowledge and how to frame Qs.

This Q has been many times. Have a search for answers.

Posted: 12. Nov 2008, 04:43
by TerryE
boardtc, the reason that I wrote the FPG and also referred you was so that you could search the forum for stuff on using qemu to convert VHDs by googling something like vhd qemu site:forums.virtualbox.org. OK hit 1 is this post, but hit 2, VPC -> VBox (vhd -> vdi) Success (and procedures) gives you what you are looking for.

However since my July post above, VBox has added in version 2 the ability to read VHDs directly so you can just open them. OK, the functionality is limited but its trivial to set up a temporary VM to do an image copy using a Clonezilla liveCD ISO boot to copy the VHD on IDE0:0 to a dynamic VDI of the same size on IDE0:1. Hope that this helps.