Using Windows Bootcamp Partition with VirtualBox?

Discussions related to using VirtualBox on Mac OS X hosts.
JimBushWhack
Posts: 77
Joined: 1. Sep 2008, 23:07
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win XP on iMac; Win 7 on MacBook pro + bootcamp
Location: SF Bay Area; California, USA

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by JimBushWhack »

New entries have been added to:
http://www.virtualbox.org/ticket/1461
One of the new entries contains a pointer to a step by step procedure by jerome, detailing how he was able to get VirtualBox to work with a bootcamp partition for a Debian Linux Guest. I would expect the same procedure would work for a Win XP bootcamp guest, or any other as well. It does require help from the trial version of vmware fusion though. Apparently, the vmdk file that VirtualBox generates is broken.
ebola
Posts: 1
Joined: 27. Aug 2009, 00:02
Primary OS: Mac OS X Leopard
VBox Version: PUEL
Guest OSses: history...

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by ebola »

using either diso0 and -partitions 3 OR disc0s3 I get VERR_DEV_IO_ERROR.
sudo !! doesn't help, either.

Its just OS X that seems broken... I had raw access booting windows under ubuntu. I don't even really care about booting the bootcamped windows... I just want raw access to my data partition from a VM.
chrus
Posts: 11
Joined: 24. Aug 2009, 15:53
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: XP

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by chrus »

Would it be possible to make a bootable iso with the windows boot.ini file (and any other files windows needs to boot). Having that mounted at startup should boot straight into wondows. Right?
mongrol
Posts: 16
Joined: 29. Oct 2007, 13:30

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by mongrol »

Ok. Here's how I do it exactly. This is using Virtualbox 3.0.4 . Any version before this is broken. Please excuse my previous ranting. It appears I did indeed use -partitions against the disk0 device.

In Finder eject the Bootcamp partition. This is usually called "untitled". Right click and choose "eject untitled"

Open terminal.app

Code: Select all

smooth:~ mongrol$ sudo chmod 777 /dev/disk0*
Password:

smooth:~ mongrol$ VBoxManage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename win7raw.vmdk -partitions 1,3
VirtualBox Command Line Management Interface Version 3.0.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

RAW host disk access VMDK file win7raw.vmdk created successfully.
We then have 2 files .vmdk files, one with -pt in the name. FIx ownership so you don't need root.

Code: Select all

sudo chown mongrol *.vmdk
Then run Virtualbox. Go into Virtual Media Manager and add the new disk. Create or edit your virtual machine to add the new disk.
Boot Windows.
Spike
Posts: 16
Joined: 26. Aug 2009, 06:23
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Fedora, Windows

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by Spike »

mongrol wrote:Ok. Here's how I do it exactly. This is using Virtualbox 3.0.4 . Any version before this is broken. Please excuse my previous ranting. It appears I did indeed use -partitions against the disk0 device.

In Finder eject the Bootcamp partition. This is usually called "untitled". Right click and choose "eject untitled"

Open terminal.app

Code: Select all

smooth:~ mongrol$ sudo chmod 777 /dev/disk0*
Password:

smooth:~ mongrol$ VBoxManage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename win7raw.vmdk -partitions 1,3
VirtualBox Command Line Management Interface Version 3.0.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

RAW host disk access VMDK file win7raw.vmdk created successfully.
We then have 2 files .vmdk files, one with -pt in the name. FIx ownership so you don't need root.

Code: Select all

sudo chown mongrol *.vmdk
Then run Virtualbox. Go into Virtual Media Manager and add the new disk. Create or edit your virtual machine to add the new disk.
Boot Windows.
Thanks for the detailed instructions. But it still didn't work right: I got a Windows error: "Windows could not start because of a computer disk hardware configuration problem. Could not read from the selected boot disk. Check boot path and disk hardware. Please check the Windows documentation about hardware disk configuration and your hardware reference manuals for additional information."

There seems to be a permissions problem somewhere, yet all files are as you indicated.
JimBushWhack
Posts: 77
Joined: 1. Sep 2008, 23:07
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win XP on iMac; Win 7 on MacBook pro + bootcamp
Location: SF Bay Area; California, USA

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by JimBushWhack »

Yes, I had the same experience that Spike did. I even tried setting the setuid bit (i.e. chmod +s) on the *-pt.vmdk file. That did not help either. I also tried the procedure outlined by Jerome in ticket 461. Even after making a vmdk file with the trial version of vmware fusion, this did not work for me for a Windows XP guest.
mongrol
Posts: 16
Joined: 29. Oct 2007, 13:30

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by mongrol »

Ah, I see you're using XP and not Windows7. What's probably happening here is the hardware profile of XP is so different from the hardware profile of your Virtual Machine that Windows simply can't boot. The VMDK file has been created ok and the VM is reading it. There's a couple of ways forward.

1) Change the VM trying different device settings. (e.g. Change Disk to IDE instead of SCSI)

2) Boot into Bootcamp XP and create a new blank hardware profile, shutdown, reboot with VM.
Spike
Posts: 16
Joined: 26. Aug 2009, 06:23
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Fedora, Windows

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by Spike »

mongrol wrote:...
1) Change the VM trying different device settings. (e.g. Change Disk to IDE instead of SCSI)

2) Boot into Bootcamp XP and create a new blank hardware profile, shutdown, reboot with VM.
Item 1 I tried with no success. Item 2 I won't try 'cause I'm worried about breaking my Windows installation. (And the fact that Parallels still works, no small miracle.)

I'll wait for others to experiment on this.
Spike
Posts: 16
Joined: 26. Aug 2009, 06:23
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Fedora, Windows

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by Spike »

Spike wrote:...I'm worried about breaking my Windows installation. (And the fact that Parallels still works, no small miracle.)

I'll wait for others to experiment on this.
My copy of Parallels 2.5 is the last I'll buy, and since it won't work with Snow Leopard anyway I've nothing to lose. I'll keep trying and looking for a solution.
Spike
Posts: 16
Joined: 26. Aug 2009, 06:23
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Fedora, Windows

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by Spike »

mongrol wrote:1) Change the VM trying different device settings. (e.g. Change Disk to IDE instead of SCSI)

2) Boot into Bootcamp XP and create a new blank hardware profile, shutdown, reboot with VM.
#1 had no effect. #2 had no effect, unless there's more to it that what you described, in which case more detailed instructions would be appreciated.
bizzynate
Posts: 1
Joined: 14. Sep 2009, 18:58
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Windows XP

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by bizzynate »

Spike wrote:"Windows could not start because of a computer disk hardware configuration problem. Could not read from the selected boot disk. Check boot path and disk hardware. Please check the Windows documentation about hardware disk configuration and your hardware reference manuals for additional information."
The 3.0.6 Update to VirtualBox has not resolved this issue.

Following "mongrol's" advice, I enabled SATA in Settings>Storage thinking it might be because the profile is trying to use IDE instead of my MacBook Pro's SATA bus. I changed the Slot to a couple SATA ports, but no joy.

Can someone please reply with a solution? The answer has to be quite close! And...dare I say that it would be excellent if Virtual Box natively supported existing partitions and installations without the need to workaround by unmounting the disk image. VMWare seems to have figured out a way to do it...
sofianito
Posts: 5
Joined: 4. Jul 2008, 14:54

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by sofianito »

Hi,

I have been able to make the trick with help of VMWare Fusion :)

Here are the steps I did ( I am using VirtualBox 3.0.6 ):

Launch Disk Utility application under /Applications/Utilities, and Unmount the Windows XP Bootcamp partition

Open terminal.app

Code: Select all

cherchalli:~ sofiane$ cd
cherchalli:~ sofiane$ sudo chmod 777 /dev/disk0s3
cherchalli:~ sofiane$ VBoxManage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename winxp_raw.vmdk -partitions 3
VirtualBox Command Line Management Interface Version 3.0.6
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

RAW host disk access VMDK file winxp_raw.vmdk created successfully.

cherchalli:~ sofiane$ ls winxp_raw*
winxp_raw-pt.vmdk	winxp_raw.vmdk
cherchalli:~ sofiane$
Run Virtualbox. Go into Virtual Media Manager and add the disk winxp_raw.vmdk. Create or edit your virtual machine to use that disk.

If you boot windows xp now you'll get the error message we all know:

Windows could not start because of a computer disk hardware
configuration problem
Could not read from the selected boot disk. Check boot path
and disk hardware.
Please check the Windows documentation about hardware disk
configuration and your hardware reference manuals for
additional information.


Ok, til now, all instructions I have mentioned are nothing new to you :mrgreen:

Here is the trick :idea: :

Quit VirtualBox application.

If you don't have VMWare Fusion, register and download a 30 day free trial version, then install it. When you run it first time, it'll automatically recognizes your existing Boot Camp partition and quickly lets you run it concurrently with your Mac. Note: Do not install VMWare Tools.

Now, overwrite file winxp_raw-pt.vmdk with VMWare Fusion BootCamp equivalent:

Code: Select all

cherchalli:~ sofiane$ cd ~/Library/Application\ Support/VMware\ Fusion/Virtual\ Machines/Boot\ Camp/%2Fdev%2Fdisk0/Boot\ Camp\ partition.vmwarevm/
cherchalli:Boot Camp partition.vmwarevm sofiane$ cp Boot\ Camp\ partition-pt.vmdk  ~/winxp_raw-pt.vmdk
Quit VMWare Fusion application.

Launch VirtualBox and boot Windows... et voilà :D

At the first boot, the mouse pointer didn't work for me at login window. If it happens to you, don't worry, use TAB and RETURN keys to navigate. After login, mouse worked properly. Also, do not forget to install VirtualBox guest additions.

Concluding observations show there might be some other issues with createrawvmdk command, but meanwhile, it does not prevent you to run your bootcamp partition with VirtualBox, with some Fusion help to initially configure it :P
Spike
Posts: 16
Joined: 26. Aug 2009, 06:23
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Fedora, Windows

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by Spike »

sofianito wrote:Hi,

I have been able to make the trick with help of VMWare Fusion :)
...

Launch VirtualBox and boot Windows... et voilà :D
This didn't work for me. When I relaunched VirtualBox I got the same warnings about the bad VMDK file I had before and I couldn't boot.
sofianito
Posts: 5
Joined: 4. Jul 2008, 14:54

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by sofianito »

Are you getting the following error message when booting?

Windows could not start because of a computer disk hardware
configuration problem
Could not read from the selected boot disk. Check boot path
and disk hardware.
Please check the Windows documentation about hardware disk
configuration and your hardware reference manuals for
additional information.



It works ootb for me after overwriting the <...>-pt.vmdk file generated with createrawvmdk with "Boot\ Camp\ partition-pt.vmdk".

Are you able to boot your Bootcamp Windows XP with VMWare fusion?

As a suggestion, leave default settings for hard disk bus type (IDE) when creating your WinXP VM with VBox GUI, and enable IO APIC.

Hope it helps.
Spike
Posts: 16
Joined: 26. Aug 2009, 06:23
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Fedora, Windows

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by Spike »

sofianito wrote:...

It works ootb for me after overwriting the <...>-pt.vmdk file generated with createrawvmdk with "Boot\ Camp\ partition-pt.vmdk".
...
As a suggestion, leave default settings for hard disk bus type (IDE) when creating your WinXP VM with VBox GUI, and enable IO APIC.
...
I'll be darned, this actually worked. Thanks for the tip. However, bootup and operation were VERY slow, it deactivated my Windows installation (requiring reactivation via Boot Camp startup), and I could not install the Guest Additions into XP. It's so not-ready-for-primetime that it's not a solution for me.
Post Reply