(Mac OS X Host) Boot a Virtual Machine from USB in VirtualBox

Booting a virtual machine from USB disk is sometimes necessary to install an Operating System as guest on VirtualBox. Unfortunately it is not supported by most of the desktop virtualization software as a built-in feature yet, really I do not understand the delay or technical difficulties in implementing this feature even by famous VMware, VirtualBox and Parallels. We have earlier published a guide shows how to boot a VM from USB on Windows host with Oracle VirtualBox. The below guide explains the steps how I managed to boot a virtual machine from USB on VirtualBox with Mac OS X host, Mac pro laptop and Mavericks OS.

Basically we need to create a VMDK file based on attached USB disk and mount the VMDK as virtual machine’s first bootable disk and boot it. Let us see the steps.

Steps to Boot a Virtual Machine from USB in VirtualBox with Mac OS X Host

1) Attach the bootable USB disk and find out the disk path. We need to use the disk path in next command.

Open the Terminal ( Go – Utilities- Terminal) and type mount

Mount command to see USBIt shows the USB disk path, note it down since we will be using it later. In this example, /dev/disk2s2 is mine.

2) Now go to disk utility (Go – Utilities- Disk Utility) and unmount the partition of USB disk. The next command will not work without unmounting the USB disk partition. Right click on USB partition and select ‘Unmount USB name’

unmount USB 3) Type following command in terminal to create VMDK file of USB disk.

sudo VBoxManage internalcommands createrawvmdk -filename /Users/Dinesh/Documents/myusbdrive.vmdk -rawdisk /dev/disk2s2

 

create raw disk /Users/Dinesh/Documents/myusbdrive.vmdk – is the location of vmdk file

/dev/disk2s2 – the USB drive path which we got from mount command earlier.

Provide the super user password to complete the task.

4) Now we have successfully created the VMDK file. Unfortunately if you attach the file to VirtualBox and try to boot,it will throw some access denied errors. We need to modify couple of permissions.

5) Since we will be using VirtualBox as a normal user but the VMDK file is created with su command, we need to give read and write access to all users  for particular VMDK file.

Type the following command to change permission of VMDK file.

sudo chmod 777 /Users/Dinesh/Documents/myusbdrive.vmdk

 

6) That’s not enough, still it throws an access denied error. We need to change the permission of USB disk too.

sudo chmod 777 /dev/disk2s2

 

7) Now the VMDK file is ready to connect and boot virtual machine from USB in VirtualBox on Mac OS X host.

Go to storage and select the controller, add hard disk. Select choose existing and browse the VMDK file we created in earlier steps.

attached vmdk

Change the hard disk SATA port number to make sure it has listed as the first hard disk for the virtual machine, so it will boot from it (like a CD/DVD drive). In this way the virtual machine will boot from USB on VirtualBox with Mac OS X Mavericks host.

3 thoughts on “(Mac OS X Host) Boot a Virtual Machine from USB in VirtualBox”

  1. Dinesh:
    Ref: Your article, “VirtualBox P2V with Disk2vhd, Possible Errors and How to Fix Them”.

    I was trying to P2V, a 64 bit win7 as a guest in a 64 bit win 7 Host.
    Your tips made it work.
    Thank you very much.
    Rajan

  2. Hello, it looks like there has been changes in Virtual Box as this is no longer working. When starting the virtual box, I get a message saying: “A critical error has occurred while running the virtual machine…” Ignore Ok. Have you experienced this error?

  3. Why do you need to boot from USB in VirtualBox? Use virtual optical contain ISO file instead. It’s similar to use live CD.

Comments are closed.