I wonder if someone could help me out with setting up virtualbox to boot from a usb drive instead of .iso file.
There is a usb /dev/sxx permissions problem I am unable to overcome in order to get virtualbox to boot from usb.
In step 5a the author starts virtualbox as root but I do not want to do that. I have already changed the permissions of the my_usb_stick.vmdk file as created in the tutorial but virtualbox still complains that I have no access to the file.
Is there any way to mount /dev/sdd as normal user or otherwise make the created file/hdd my_usb_stick.vmdk to be opened by virtualbox as my normal user.
That article is over a year old, and technology does fly in that amount of time.
Additionally, I’m amused that article describes creating a vmdk(VMware disk) formatted disk. Should work, I think it’s something interesting that may provide some insight into the author’s background and/or unstated objectives.
Since I don’t know what is on your USB disk or whether you intend to use it like a LiveCD (maybe that’s where your original image came from?), I’m covering several bases in the following…
Although I haven’t done the following, I’m pretty sure it should work and I would guess should be simpler.
Try to boot directly from unmodified media. This would require mounting your USB to look like one of the following accepted VBox boot devices and configuring that boot device in the Guest Settings.
From the Virtualbox Help
Boot order
This setting determines the order in which the guest operating system will attempt to boot from the various virtual boot devices. Analogous to a real PC’s BIOS setting, VirtualBox can tell a guest OS to start from the virtual floppy, the virtual CD/DVD drive, the virtual hard drive (each of these as defined by the other VM settings), the network, or none of these.
If you select “Network”, the VM will attempt to boot from a network via the PXE mechanism. This needs to be configured in detail on the command line; please see Section 8.8, “VBoxManage modifyvm”.
If you intend to run as a LiveCD, then make an ISO file (one of the acceptable boot device types described in the Help) and point your Guest to it. Remember in the Guest Settings > Storage > CDROM to check the “LiveCD” box
if you want to create a Guest with a writable image (unlike a LiveCD), then <one> of the options is more or less as described in your reference… Create an empty virtual disk file (format of your choosing), mount it and dd your bootable image into the virgin disk file.
Depending on your situation, you may find that this whole process of using pre-built bootable images is a whole lot of trouble. Just do a regular VM Install pointing to creating a disk file on your USB stick (or whatever media). The only requirement here of course is that the storage media is mountable on the Host. If it can be mounted on the Host, then it can be seen by the Guest.
Although I haven’t investigated in Virtualbox, access to a raw file system (not a virtual disk file) is possible in every other virtualization technology I’ve dealt with so I assume should be possible in VBox as well. The reason why this is not generally exposed or recommended is because it bypasses file locks and checks in an OS so it then is easily possible to corrupt the system (any OS using those files).
Somehow without answering my direct question (did I have one??) you have managed to enlighten me beyond my first aspirations, thank you.
I will consider your suggestions and take appropriate action.
After rethinking my approach from the suggestions above I decided to make an iso from my bootable usb stick and all went smoothly.
I guess there is a combination of command line programs to do this and wish I did know them as it would be easier but I found this program and it worked good.
I am not sure about some aspects of this program, there was a web page advertisement type thing that opened up when I clicked the “update” tab… Hmmmm, it is gone now but hmmmm? Wait yes, it appears to be a complete advertising bot of some sort.
Well I wonder what my poor iso bootable file has in it from this program :\
I’m the author of that article. My intention was to test the boot process of a Linux from Scratch USB stick. I don’t wanted to boot a live system. I’ve installed the OS manually on a stick like on a regular hard drive. (Meaning changes will persist on stick across reboots).
Unfortunately VirtualBox supports direct host disk access for the vdmk format only. You can basically follow this guide from their documentation: http://www.virtualbox.org/manual/ch09.html#rawdisk (Chapter 9.9.1.1. Access to entire physical hard disk). This was tricky to find out that time but helped me a lot. That’s why I wrote the article.
Reading the article again, I see that requiring root permissions to run the solution looks a bit ugly. I’ll review this and hope that I can show a better way then. If so, I’ll update the article and drop a message here as well.
Cool,
Thx for contributing (and finding this thread).
I find it extremely surprising that VirtualBox should support <only> a rival’s disk format and not all VB-supported disk formats (although anything’s possible). In fact, after reading your reference, without actual testing I still strongly suspect that the author of your reference likely just chose the .vmdk disk format just to simplify the documentation (choose any that is sufficient, it likely doesn’t matter. The danger is to choose something that’s not supported)
Also, it’s good that you’ve reviewed what you wrote and consider the information still valid.
You can avoid running VirtualBox as root if you’re just after about the rawdisk access by adding your self to the group disk. First check out the permissions on the device.
ls -l /dev/sd[a-z]
and
stat -c '%G' /dev/sd[a-z]
You will see that the owner is root but the group is disk, now add yourself to the group disk by using yast2 users or
gpasswd -a foo vboxusers
Where foo is the username. You will need to log-out for that to take effect, after that you can run VBoxManage to create your rawdisk. Just keep in mind your user is part of the group disk now, because adding a user to that group might give some surprises even for the most experienced sysadmins ;).