MacOS – Boot VirtualBox VM from USB on macOS

boot-campmacosvirtual machinevirtualbox

I'm trying to save space on my Mac's internal hard drive by installing a Windows 10 virtual machine on a 128gb USB 3.1 USB, but I can't seem to figure out how to boot from the USB with VirtualBox.

I have been able to boot the ISO which just functions as an installer, but I want to boot the USB that has had a Windows-To-Go ISO burnt to it. Could someone explain?

I have already tried avoiding the virtual machine method all-together and making a UEFI bootable drive, but it keeps crashing with INACCESSIBLE_BOOT_DEVICE in Windows 10 (I'm guessing this is something to do with how the USB is mounted during bootup as I have already installed the recommended drivers).

Best Answer

If you want to boot from a bootable USB, you have to make a pass-through device.

This assumes you have USB Installer already created or an image of that installer as a file.

Step 1: Create the Installation Media

Using hdiutil create a sparse (expanding) disk image with a size of 6GB

hdiutil create -size 8GB -fs FAT32 -volname "Win10-Install-Media" -type SPARSE ~/win10-installation-media

Next, mount the image

hdiutil mount ~/win10-installation-media.sparseimage

You will get a message that describes the layout of the drive image. Pay attention to the disk identifier as you will need it for the next step.

Copy the install USB to the image

dd if=/path/to/USB/Installer of=/dev/disk#

The newly created image will need to be unmounted for the next step, so go ahead an unmount the disk.

diskutil unmountDisk /dev/disk#

Step 2: Create the VMDK

To do this, we are going to use VirtualBox's "raw hard disk access" to create a pass through to the newly created drive image.

The syntax of the command is as follows:

VBoxManage internalcommands createrawvmdk -filename </path/to/file>.vmdk -rawdisk /dev/disk#

So, for our purposes, the command would be (note the escaped spaces)

VBoxManage internalcommands createrawvmdk -filename ~/Windows\ 10\ Install.vmdk -rawdisk /dev/disk#

The VMDK will be a very small file that simply points to disk you created in Step 1. Now you can attach the VMDK to your VM and boot from it.

Related Question