I recently was playing with a new 4GB usb stick and I wanted it install a rawdisk VirtualBox VM on it. This would give a portable VM with decent speed.When I was trying to create the raw disk formated disk with the following command:
#> vboxmanage internalcommands -rawdisk /dev/sdc -filename ~/VirtualBox\ VMs/usbstick.vmdk
I recieved the following error. I even got this error running as root. I determined it wasn't a permissons issue.
VBoxManage: error: Cannot open the raw disk '/dev/sdc': VERR_MEDIA_NOT_PRESENT VBoxManage: error: The raw disk vmdk file was not created
After verifying that the device file did truely exist and that the permissions were not an issue. I did some wondering. What else would be touching this. Then I noticed gnome (nautilus) was automounting USB sticks. I then disabled the usb stick automounting. This affects all USB mass storage devices. I did this by opening the gconf-editor program.
I then browsed thought the menu tree to apps -> nautilus -> preferences localtion. Then in right column I disabled the media_automount and media_automount_open options. Close gconf-editor. Unplug and reinsert the usb stick. Now I was able to create the rawdisk without a problem.
#> vboxmanage internalcommands -rawdisk /dev/sdc -filename ~/VirtualBox\ VMs/usbstick.vmdk RAW host disk access VMDK file /home/hydrian/VirtualBox VMs/usbstick.vmdk created successfully.
It seemed that nautilus was grabbing and holding control of the USB stick even after I unmounted it. After disabling the above options, nautilus now never grabs access unless told to.