Run Boot Camp Windows10 partition inside VirtualBox

Solution 1:

I also followed the guide at http://web.archive.org/web/20181103074214/http://danielphil.github.io/windows/virtualbox/osx/2015/08/25/virtualbox-boot-camp.html

I will add what challenges I had following that guide, but I was able to run my BOOTCAMP partition using VirtualBox, which is free, so I'm happy.

First, you should have installed:

  • Windows 10 x64 using the OS X Boot Camp assistant
  • VirtualBox 5.0.26 r108824

I also downloaded:

  • VBoxGuestAdditions_5.0.26.iso (I don't think this is necessary, but I did it just to be safe)

As far as Disabling SIP or System Integrity Protection on El Capitan (OS X 10.11), I skipped that part. It was not necessary in my case.

As far as setting drive permissions:

  1. I ran diskutil list to get a list of drives on my system, taking note of the drive number of the drive named EFI and the other one named BOOTCAMP, which in my case, the EFI drive was 1 and the BOOTCAMP drive was 4.
  2. I then ran the instructions to unmount my Bootcamp drive and set permissions so that VirtualBox could access the drive. According to danielphil, this needs to be performed each time one reboots.

    diskutil unmount /Volumes/BOOTCAMP

    sudo chmod 777 /dev/disk0s1 <--- This is the drive no. of the EFI disk

    sudo chmod 777 /dev/disk0s4 <--- This is the drive no. of the BOOTCAMP disk

As far as creating the VirtualBox image, the instructions are:

Run the following commands to create a VirtualBox disk image wrapper for >your HD. Substitute the 1,4 with the numbers of your EFI and BOOTCAMP >partitions as appropriate and put your OS X username in for >your_username_here. Make sure you are in the directory where you want to store the VirtualBox image, or you will have to move it later.

sudo VBoxManage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename win10raw.vmdk -partitions 1,4
sudo chown your_username_here *.vmdk

As far as creating the VM, the guide was not so clear. Before I followed the instructions from the screenshots, I created a new virtual machine in VirtualBox, checking "Do not add a virtual hard disk".

creating the new virtual machine

Once created, I selected it and clicked on "Settings". At this point, I followed the screenshots in the guide. The only difference was that:

  • I did NOT check "Enable EFI (special OS only)"
  • I did NOT have the option to check "Enable VT-x/AMD-V"
  • I used the recommended base memory of 2048 MB, as I only have 8GB of memory
  • In the "Storage" tab under "Storage Tree", I had to:
    • click the "adds optical drive" icon under Controller:SATA to add the "VBoxGuestAdditions_5.0.26.iso" file I downloaded.
    • remove the "empty" image under Controller:SATA
    • Select the "Add IDE Controller" icon at the bottom
    • click the "adds hard disk" icon under Controller:IDE to add the vmdk file created

Solution 2:

For the benefit of others, I managed to get this working. This is on Mojave by the way.

  1. I had to disable SIP in order to create the VMDK. It just wouldn't create the VMDK until I had disabled SIP (to disable SIP you have to boot your Mac in recovery mode by holding Command+R on start up, then when you're in recovery you open a Terminal - the option is within one of the Menu Bar drop-downs - then you type in csrutil disable).
  2. When I created the VMDK it actually created two of them. The one without the "-t" extension is the one that VirtualBox seems to understand.
  3. I could only get the VM to boot by enabling EFI within VirtualBox's settings (go into the settings for your Windows 10 VM, select the "System" tab which is the second along the top row, and at the bottom of the "Motherboard" pane there is a checkbox saying "Enable EFI (Special OSes only)".

After this, it did boot. Whether it still boots after re-enabling SIP I don't know, but I think it would going by the comments here. I think disabling SIP is only necessary for creating the VMDK. But I haven't tested running the VM after re-enabling SIP.

And I probably won't test that, because unfortunately the VM performance is pretty terrible. The reason I did this whole thing was to try and play Halo (a relatively old game released in 2003 on the PC, but still a 3D game) from my Windows partition inside the VM. So that I wouldn't have to reboot into my Windows partition to play it. Halo does have a Mac version, but it won't work on Catalina since Catalina has dropped support for 32-bit apps, which is why I was trying this. But yeah, the performance was... terrible. About 1 frame per second or even less. Maybe if I tweaked the settings it might work better but it seems pretty rubbish. I even managed to run this game using Wine and it gave me perfectly smooth performance, even though it made my CPU run at a constant 80+C even with fans manually set to full speed. So Wine, for this, seems to be better than VirtualBox.

But if you need to get your Windows Boot Camp partition running with Virtual Box just for maybe testing a website in IE or something then this solution could work. I was able to boot Windows and while Halo ran very badly, the OS itself didn't run that badly.