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 »

I think your problem here is that the vboxmanage command line is incorrect. It should be:
sudo vboxmanage internalcommands createrawvmdk -rawdisk /dev/disk0s3 -filename win7.vmdk

If you do a: sudo vboxmanage internalcommands listpartitions -rawdisk /dev/disk0, you will see a formatted
partition table. On my system, it looks like this:
sudo vboxmanage internalcommands listpartitions -rawdisk /dev/disk0
VirtualBox Command Line Management Interface Version 3.1.2
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

Number Type StartCHS EndCHS Size (MiB) Start (Sect)
1 0xee 0 /0 /2 25 /127/14 200 1
2 0xaf 25 /127/15 1023/152/54 206720 409640
3 0x0c 1023/233/56 1023/80 /23 31427 424034344

So slice 3 (/dev/disk0s3) is the windows bootcamp partition, slice 2(/dev/disk0s2) is the MacOS X partition, slice 1 is the socalled "EFI partition", starting at sector 1 and /dev/disk0 describes the entire disk.

But also note that due to the problems described in ticket #1461, many people have had varying degrees of success in getting a bootcamp partition to work. I have been trying to bring up my bootcamp Win XP partition for going on 2 years now with no luck. I guess that people have had some degree of luck getting Win 7 bootcamp partitions up under VBox. But they are very slow at that.
Beren
Posts: 2
Joined: 9. Jul 2010, 09:42
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Windows 7

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by Beren »

Just like many people in this thread, having an issue. Tried multiple diff combination's and this is what I get with most.

Image

Windows 7 Installed via boot camp. Win64

Most recent attempt was with

sudo vboxmanage internalcommands createrawvmdk -rawdisk /dev/disk0s3 -filename win7.vmdk

also recently tried

VBoxManage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename win7raw.vmdk -partitions 1,3

Ownership on *.vmdk, 777 on disk0 and disk0s3

I have tried changing IDE config and to diff sata ports.

Ideas?
Beren
Posts: 2
Joined: 9. Jul 2010, 09:42
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Windows 7

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by Beren »

I got to working. Just more of the same tinkering. Turning everything off and adjusting and redoing. stuff.
SonicEarth
Posts: 1
Joined: 13. Jul 2010, 06:00
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Windows 7

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by SonicEarth »

I am getting a blue screen every time the virtual machine boots.
Screen shot 2010-07-12 at 11.07.09 PM.png
Screen shot 2010-07-12 at 11.07.09 PM.png (41.25 KiB) Viewed 39433 times
toshe
Posts: 1
Joined: 17. Jul 2010, 19:37
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Win7

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by toshe »

One Solution for VERR_NOT_SUPPORTED.

I had to fight the whole saturday with the VERR_NOT_SUPPORTED error.
I couldn't get it to work with VirtualBox 3.2.6.
I installed 3.0.8 from the http://download.virtualbox.org/virtualbox/
and followed the steps from reido's post.
I than get Windows 7 32bit to run without problems (with the IDE Controller set to ICH6).
I installed 3.0.14 without removing the 3.0.8 first and the virtual machine started. 3.1.8 worked also.
I am now running the latest VirtualBox 3.2.6 with the vmdk files generated from 3.0.8.
Maybe the vmdk generation in the latest version is broken.
I am running OS X 10.6.4 as host.

have fun,
toshe
ChipMcK
Volunteer
Posts: 1095
Joined: 20. May 2009, 02:17
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Windows, OSX
Location: U S of A

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by ChipMcK »

SonicEarth wrote:I am getting a blue screen every time the virtual machine boots.
Screen shot 2010-07-12 at 11.07.09 PM.png
Google search "stop 0x0000007b"
ilyxa
Posts: 39
Joined: 2. Apr 2009, 15:29
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Opensolaris, Solaris, Sun Storage
Location: Russia
Contact:

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by ilyxa »

WARNING: THIS ACTION CAN REALLY DESTROY YOUR DATA!!! ALL OF MY ACTION IS DONE "AS IS" AND YOU CAN TRY IT WITH YOUR OWN WITHOUT ANY GUARANTEE!

I don't believe at magic at all ;) Get a terminal, and make some noise around, i found simple thing.

Now checked - work just fine without VMWare hack ;)

Step to reproduce (probably, in my case):
- create yours *vmdk as odinary (i'll done this without admin rights):

Code: Select all

VBoxManage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename BootCampXP.vmdk -partitions 3
- UPDATE: you can just skip this step! make a copy of your MBR (yes, yes! it has GPT label, but you can try - legacy MBR is here) record placed at the begininng of your disk:

Code: Select all

dd if=/dev/disk0 of=BootCampXP-pt.vmdk bs=512 count=1
... i have no idea why Fusion create file with size 32256 bytes - some kind of VMWare magic, is it? ;)


- check your output of listpartitions cmd:

Code: Select all

vintage-c2d:~ ilyxa$ sudo VBoxManage internalcommands listpartitions -rawdisk /dev/disk0
Password:
Oracle VM VirtualBox Command Line Management Interface Version 3.2.8
(C) 2005-2010 Oracle Corporation
All rights reserved.

Number  Type   StartCHS       EndCHS      Size (MiB)  Start (Sect)
1       0xee  0   /0  /2   25  /127/14           200            1
2       0xaf  25  /127/15  1023/254/63         97152       409640
3       0x07  1023/254/63  1023/254/63         16992    199641088
vintage-c2d:~ ilyxa$ 
... and ...

Code: Select all

vintage-c2d:~ ilyxa$ file BootCampXP-pt.vmdk
BootCampXP-pt.vmdk: x86 boot sector, Microsoft Windows XP MBR, Serial 0xca5bca5b; partition 1: ID=0xee, starthead 0, startsector 1, 409639 sectors; partition 2: ID=0xaf, starthead 127, startsector 409640, 198967296 sectors; partition 3: ID=0x7, active, starthead 254, startsector 199641088, 34799616 sectors, code offset 0xc0
... as you see - Partition 1 and 2 has an ID=0xee and ID=0xaf - all you need to do is to replace them with another part type (0x2d).

- you need to find out your partitions, in my case:

Code: Select all

vintage-c2d:~ ilyxa$ hexdump BootCampXP-pt.vmdk | grep 0001c0
00001c0 02 00 ee 7f 0e 19 01 00 00 00 27 40 06 00 00 7f
vintage-c2d:~ ilyxa$ hexdump BootCampXP-pt.vmdk | grep 0001d0
00001d0 0f 19 af fe ff ff 28 40 06 00 00 00 dc 0b 80 fe
vintage-c2d:~ ilyxa$ 
... and then - issue a 2 command:

Code: Select all

echo -en "\x2d" | dd of=BootCamp-pt.vmdk bs=1 count=1 seek=450 conv=notrunc
echo -en "\x2d" | dd of=BootCampXP-pt.vmdk bs=1 count=1 seek=466 conv=notrunc
.. where 450 = 0x1c0 + 0x2, etc.

Next - follow the instruction as usual :)

For me - it works fine, some someone find it helpfull.

And, guys, sorry for my dirty english :(
http://www.nest.org.ru/ - Nest.Org.Ru Team Site, my blog (mainly Russian)
tplayford
Posts: 1
Joined: 5. Sep 2010, 13:09
Primary OS: Mac OS X Leopard
VBox Version: PUEL
Guest OSses: Windows

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by tplayford »

Ilyxa's hacking around with the partition types worked - for me anyway. Make sure you understand what hex is first though.

I had to use the IDE controller, wouldn't work with SATA.

Thanks for the hint.
winhater
Posts: 2
Joined: 29. Sep 2010, 15:29
Primary OS: Mandriva
VBox Version: OSE Debian
Guest OSses: Windows 7

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by winhater »

Thanks v. much toshe! Couldn't face ilyxa's hexmangling and I was really stuck and fed up, as all the advice still hadn't worked for me (including the VMWare Fusion workaround). toshe's solution finally worked for me with a Win7 guest running in Snow Leopard (Mac OS 10.6.4).

In other words, install VB 3.0.8 (i.e. from before the vmdk thing started going wrong - I found I didn't need to uninstall the later version first). Follow reido/Anil/everyone's advice as below, setting the IDE controller to ICH6, then upgrade VirtualBox to the latest version (currently 3.2.8 at time of writing - easy to do from the 'Check for updates' menu command). Phew, at long, long last...

Download VB 3.0.8 from here:

http://download.virtualbox.org/virtualbox/3.2.8/

Below I've repeated reido's summary of the other instructions, to save anyone else having to go back and find them. If you've never used Terminal before on your Mac, it's probably either in the Applications folder or its Utilities subfolder.

In Terminal, type these three commands (you can copy and paste them, except the 3rd one, and hit the 'return' key each time)…
First:
sudo chmod 777 /dev/disk0s3

Second:
sudo VBoxManage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename win7raw.vmdk -partitions 3

Doing so will create two files in your home directory called win7raw.vmdk and win7raw-pt.vmdk. Because the second command is run via sudo, the two files created will be owned by root user. Perform the following command to change the ownership:

sudo chown yourusernamehere win7raw.vmdk win7raw-pt.vmdk
(Obviously, change 'yourusername' to the username you use on your Mac.)

After that you can proceed to run “VirtualBox”. In “VirtualBox”, start it up, and create a “new” virtual machine. (I gave mine about 1.5GB of base RAM - not sure how well it works with the default.)

On about the 3rd “Next>” click, click “use existing hard disk” and then browse (i.e. click the little yellow folder-like icon). Click “Add”, then under “yourusername” there is the file “win7raw.vmdk”. Select it and then click “open” then “select”. Finish the “Create New Virtual Machine” setup. Your machine should be showing in that window, with whatever name you called it.

In the main pane, select your new machine, select “Details” (if it's not showing already), click on “Storage” and change the “IDE Controller” to “ICH6”. Start your machine by double clicking it, or by selecting it and clicking “Start”.

Whoopee :lol:
winhater
Posts: 2
Joined: 29. Sep 2010, 15:29
Primary OS: Mandriva
VBox Version: OSE Debian
Guest OSses: Windows 7

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by winhater »

oops, that link should have been:

http://download.virtualbox.org/virtualbox/3.0.8/

Sorry!
fortfive
Posts: 2
Joined: 12. Oct 2010, 21:22
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: windows

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by fortfive »

Point of clarification from winhater's post:

sudo VBoxManage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename win7raw.vmdk -partitions 3

Be sure to substitute the name of your boot camp partition for "win7raw" in the above command.

I have yet to test the rest of the post, but I do have a vmdk file now.

Thanks, winhater!
belum2aj
Posts: 2
Joined: 27. Oct 2010, 19:28
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Windows 7

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by belum2aj »

Hi
I've done all the steps but Am getting "Invalid Settings" error in the last one.
Looks like this


Image

Uploaded with ImageShack.us

does somebody know what does it mean??
thanks :)

PS: Yo, and I'm trying to get it working on the latest OSX(10.6.4), with the latest Vbox(3.2.1) and latest Windows7x64(guestOS) with the latest Bootcamp.drivers, installed on a NTFS formated 32gb partition(disk0s3)
PS1: the only difference is, that I unmount the BOOTCAMP partition on startup through this lines in /etc/rc.local

Code: Select all

diskutil umount /Volumes/BOOTCAMP
sudo chmod 777 /dev/disk0s3
ninjoblio
Posts: 1
Joined: 26. Nov 2010, 22:09
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Win7

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by ninjoblio »

re:belum2aj

I had to remove the SATA drive from the list to get around the error you're getting.

My problem after that though is I can 'start' my windows 7 partition in VB, and it gets to the 'loading files' screen/bar from Windows 7... but then bumps me back to the virtual box loading screen and starts all over. I looked in the log files for VB and I see this when the files are loading...
00:00:07.306 Display::handleDisplayResize(): uScreenId = 0, pvVRAM=1a7a1000 w=1024 h=768 bpp=24 cbLine=0xC00

When the bar is full and you'd normally see the windows login screen, I get this in the log...
00:00:37.679 Changing the VM state from 'RUNNING' to 'RESETTING'.

Anyone seen this before. It just loops and loops and loops through this forever. It looks like I'm getting some kind of error requiring a restart, but VB isn't really telling me a whole lot about what went wrong.

I'm running VB 3.2.10, Windows 7 64 with bootcamp, mac osx 10.6.5. MPB 13", unibody 2.4 ghz
mildred
Posts: 3
Joined: 29. Nov 2010, 02:45
Primary OS: Mac OS X Leopard
VBox Version: OSE Debian
Guest OSses: Vista

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by mildred »

Help...

I'm trying to setup Windows Vista on my Imac using VirtualBox... I've done the following.

1. Installed Version 3.0.8

2. Ejected my Windows Disk (BOOTCAMP)

3. Started Terminal and entered the following:
sudo chmod 777 /dev/disk0s3
sudo VBoxManage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename BOOTCAMP.vmdk -partitions 3
sudo chown myusername BOOTCAMP.vmdk BOOTCAMP-pt.vmdk

4. Run VirtualBox and setup the machine as per the instructions in this thread - Also changing the storage to ICH6.

When I start the machine, the window just goes blank after the initial Oracle page. Nothing happens after that!!!

Funnily enough though if I close the session and start a new one, it comes up with the "Windows Failed To Start" page.

If I select to start Windows normally, then the page just goes blank and VM hangs
If I select Safe Mode or Safe Mode with either Network Support or Command Prompt then VM hangs after loading crcdisk.sys
If I select Last Known Good Configuration, then the page just goes blank and VM hangs.

Please help me!!!!

Pedro
mk01
Posts: 6
Joined: 29. Nov 2009, 00:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Windows 7, Fedora

Re: Using Windows Bootcamp Partition with VirtualBox?

Post by mk01 »

mildred wrote:
4. Run VirtualBox and setup the machine as per the instructions in this thread - Also changing the storage to ICH6.

When I start the machine, the window just goes blank after the initial Oracle page. Nothing happens after that!!!

Funnily enough though if I close the session and start a new one, it comes up with the "Windows Failed To Start" page.

If I select to start Windows normally, then the page just goes blank and VM hangs
If I select Safe Mode or Safe Mode with either Network Support or Command Prompt then VM hangs after loading crcdisk.sys
If I select Last Known Good Configuration, then the page just goes blank and VM hangs.

Please help me!!!!

Pedro
It hangs, because windows can't access system disk.

For the .vmdk image create SATA controller and access it in AHCI mode. Best way is to boot windows in bootcamp and check, what's the disk driver.

mk
Post Reply