by  Marirs

Boot from USB with VirtualBox on Mac

VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for enterprise as well as home use. Not only is VirtualBox an extremely feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software under the terms of the GNU General Public License (GPL) version 2.

Requirements:

01. Mac OSx (Tested in Yosemite & El Capitan)

02. Virtual Box: https://www.virtualbox.org/wiki/Downloads

03. Virtual Box Extension Pack – The Extension Pack basically enables the USB 2.0 ∓ 3.0 ports, with lots of other features.

I assume, you have already installed Yosemite, VirtualBox, and the VirtualBox Extension Pack as well. Follow the below steps for USB Boot with VirtualBox:

Steps to follow:

  • In Terminal

    On your OSx, open a Terminal Window and List all your device and identify your USB drive:

    [[email protected]]$ diskutil list
    /dev/disk0 (internal, physical):
    #:                       TYPE NAME                    SIZE       IDENTIFIER
    0:      GUID_partition_scheme                        *500.3 GB   disk0
    1:                        EFI EFI                     209.7 MB   disk0s1
    2:          Apple_CoreStorage OSx                     499.4 GB   disk0s2
    3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
    /dev/disk1 (internal, virtual):
    #:                       TYPE NAME                    SIZE       IDENTIFIER
    0:                  Apple_HFS OSx                    +499.0 GB   disk1
                                  Logical Volume on disk0s2
                                  A1AA1EC0-33FF-42A4-B9F0-FAKE99D91ED4
                                  Unencrypted
    /dev/disk2 (disk image):
    #:                       TYPE NAME                    SIZE       IDENTIFIER
    0:      GUID_partition_scheme                        +99.6 MB    disk2
    1:                  Apple_HFS VirtualBox              99.6 MB    disk2s1
    /dev/disk3 (external, physical):
    #:                       TYPE NAME                    SIZE       IDENTIFIER
    0:     FDisk_partition_scheme                        *128.0 GB   disk3
    1:               Windows_NTFS IRONKEY                 128.0 GB   disk3s1
                            

    You will see a list like the above. According to the above list, My USB is /dev/disk3 (Windows_NTFS IRONKEY).

  • Umounting

    Lets unmount the disk now:

    [[email protected]]$ diskutil unmountDisk /dev/disk3
    Unmount of all volumes on disk3 was successful                      
                            
  • Permissions

    VirtualBox process can only read/write files owned by the current user you are logged with. Mac OS X puts root as owner. With this default, you won’t be able to import the disk file that we are going to create. So the solution is too change the permission of the device:

    [[email protected]]$ sudo chown user /dev/disk3
    [[email protected]]$ ls -l /dev/disk3
    brw-r—–  1 user  operator    1,   7 Jul  10 19:11 /dev/disk3
                            

    Keep in mind to change the “user” to your username

  • Disk creation

    Now create a disk file:

    [[email protected]]$ VBoxManage internalcommands createrawvmdk -filename ~/Documents/usbdrive.vmdk -rawdisk /dev/disk3
     RAW host disk access VMDK file ~/Documents/usbdrive.vmdk created successfully.                        
  • Add the VMDK

    Now add this vmdk file to your Virtual Media Manager (⌘D) or add as an "Use existing hard drive" to your Virtual Machine.

    In case you get an Error while adding this drive like shown below:

    Just unmount the disk again. The disk could have mounted back to the OS.

    [[email protected]]$ diskutil unmountDisk /dev/disk3
    Unmount of all volumes on disk3 was successful                        

Thats all for this!