Mounting a USB stick with VirtualBox

From Exterior Memory
Revision as of 17:30, 13 August 2012 by MacFreek (Talk | contribs) (USB2 is not supported by VirtualBox)

Jump to: navigation, search

I used VirtualBox to create a bootable USB key with FreeBSD using VirtualBox on my Mac. Here are a few issues I ran into.

USB2 is not supported by VirtualBox

VirtualBox does not support USB2 by default. If you try to mount a USB device, you will get a warning that it requires 'Oracle VM VirtualBox Extension Pack'. Download from the VirtualBox website and install extension pack by simply dragging it to the VirtualBox application.

Determine the mount location of the disk

The mount location of the USB disk is determined by your operating system and presently available hardware. The names typically take these forms:

  • /dev/da0 on FreeBSD
  • /dev/disk2 on Mac OS X
  • /dev/sda1 on Linux

If the USB key is already mounted, these tools list the mounted disks:

  • mount on Linux and FreeBSD
  • diskutil list on Mac OS X

Mac does not fully unmount USB stick

Problem: Ejecting a disk in the Finder only ejects the partition, but does not unmount the whole disk.

Solution: determine the disk, and unmount using diskutil:

diskutil list
diskutil unmountDisk /dev/disk2

No USB devices found

Deattach USB disk from host computer, and attach to to Virtual Box.

Problem
Installer shows up, but I can't select a USB disk. Even after rescanning, and checking the fixit menu, it gaves an error "No USB devices found".
Solution
I installed FreeBSD on virtual disk, instead of USB disk. Succeeded.

USB_ERR_TIMEOUT

Booted FreeBSD in VirtualBox, and attached USB disk. Error:

uhub_reattach_port: port 1 reset failed, error=USB_ERR_TIMEOUT
uhub_reattach_port: device problem (USB_ERR_TIMEOUT), disabling port 1

Seems a bug in VirtualBox. See issue #8182

In VirtualBox settings (under ports > USB) Disable USB 2.0 (EHCI) Controller.

Reboot the Virtual box.

Now the USB key works fine in FreeBSD, and is made available at /dev/da0..