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
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’
sudo VBoxManage internalcommands createrawvmdk -filename /Users/Dinesh/Documents/myusbdrive.vmdk -rawdisk /dev/disk2s2
/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.
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.