Page 1 of 1

Virtualizing a Boot Camp partition is hard!

Posted: Fri Jun 22, 2012 12:26 pm
by bthylafh
So I want to virtualize the Win7 Boot Camp partition on my soon-to-be-retired work Macbook 2,1, because there's a tool I use occasionally that's hard to set up right and I don't use it often enough to remember how it was originally done.

VMware has a tool that can virtualize a running machine over the network. Doesn't work with a Mac's GPT partitions.

So here's the procedure that worked for me:
1) Install a utility called disk2vhd on the Macbook's Win7 install. Make sure you have less than 50% of the partition in use.
2) Run disk2vhd and then copy the resulting .VHD over the network to the VM host machine.
3) Create a new VirtualBox[1] VM. Remove the SATA controller, make sure the IDE controller's set to emulate a PIIX3 (x4 might work, ICH6 definitely does not), attach VHD to the IDE controller.
4) Should boot.

If it doesn't boot at this point, you might have to convert the VHD's GPT partition table to MBR. I downloaded SystemRescueCD, attached the ISO to the virtual machine, booted from it, then ran gdisk using this tutorial:
http://www.rodsbooks.com/gdisk/mbr2gpt.html

Since I'm using VMware for all my other work VMs, I'm going to try converting the VirtualBox VM over next.

[1] MS Virtual PC can't deal with VHDs created from a disk that's bigger than 137GB and VMware Player can't directly use VHDs. VMware's aforementioned virtualization tool can import VPC VMs, but again VPC can't see those big disks. This was a huge pain in the butt!

Re: Virtualizing a Boot Camp partition is hard!

Posted: Fri Jun 22, 2012 5:41 pm
by bthylafh
VMware Player's OVA import is still a bit crap. I told VirtualBox to export as v0.9 OVA format (for compatibility) but VP still choked, apparently because in a fit of OCD I filled out the metadata that VirtualBox wanted (OS, version, mfr, URLs, etc.) - it said that it couldn't do anything with the metadata and instead of gracefully ignoring fairly useless metadata it failed. So now I have to re-export a 40-some GB virtual machine and hope that not filling that info in will fix it.

Sigh. I'll probably find out that Win7 won't boot because VMware prefers to emulate a SCSI controller and/or it doesn't like its IDE.

...hmm, maybe I could try using that official import tool and point it at the VB vm and not worry about exporting first. It can wait until Monday.

Re: Virtualizing a Boot Camp partition is hard!

Posted: Fri Jun 22, 2012 8:04 pm
by LaChupacabra
This is a little late for you, but it may help someone else, so here's another way of (probably, i've never tried it) doing it.

The built in backup tool in Windows 7 is pretty spectacular. If you do a full image backup it will create a bare-metal backup and save it as a .vhd to whatever directory or drive you want. Take a full backup.

Then load up VMware and create a new VM, specifying that you will install the operating system later. Either mount the Windows .iso you used to install Windows in VMware or insert the media into your computer, turn on the VM and boot in the appropriate way. Boot into the recovery console.

In the recovery console you can do a full restore of your system. No messing about with partitions, Virtual Box, or installing any third party utilities onto your Windows box. Something worth noting in this process is that the .vhd that Windows backup makes is not bootable. All of that gets stripped out when you create the backup image, so being able to boot into the recovery console is a requirement to complete this process.

Again, late to the party to help you, but maybe it'll help someone else!

Re: Virtualizing a Boot Camp partition is hard!

Posted: Fri Jun 22, 2012 9:21 pm
by bthylafh
Huh, thanks. That might come in handy some other time! :)

Re: Virtualizing a Boot Camp partition is hard!

Posted: Fri Jun 22, 2012 9:59 pm
by DeadOfKnight
That's not all that's hard ;)

Re: Virtualizing a Boot Camp partition is hard!

Posted: Fri Jun 22, 2012 10:11 pm
by bthylafh
DeadOfKnight wrote:
That's not all that's hard ;)


:P I left out all the stuff I tried first.