Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to install an operating system onto a USB drive, and then boot to it, all within VirtualBox? Not like putting the virtual disk on the USB drive. Installing the entire OS there so it can be booted to from other computers as well. To be specific, the OS I'm planning on installing is Arch.

Edit, for clarity:

I have a Mac as the host. And I plan to use Arch as somewhat of a temporary host. I plan to run the LiveCD in VirtualBox and then install Arch not to a VirtualBox virtual drive, but to a USB drive that I can then boot other computers off of. VirtualBox will be simply a way to run the LiveCD. After this, I will want to do some configuring/testing on VirtualBox, with that USB drive. Will I be able to boot from the USB drive, almost as if it were a LiveCD?

Note that I also want this disk to be perfectly bootable from another machine, like a LiveUSB distro.

share|improve this question
1  
I think this is possible, but you need that Linux USB loader thing to first initialize the system. VirtualBox cannot boot from USB by default. –  cp2141 Aug 18 '11 at 21:59
2  
possible duplicate of How to boot from a flash drive OS using VirtualBox? –  Breakthrough Aug 18 '11 at 22:00
1  
@breakthrough: this isn't a dupe. My question asks about installing to the drive too. –  Wuffers Aug 18 '11 at 22:35
    
Whatever OS runs as the result of booting from your USB drive, and starts the installation process, should be able to detect the virtual hard drive provided by VirtualBox (that has to be configured prior to booting from your USB device) so that the installer can use it as a target. –  Randolf Richardson Aug 18 '11 at 23:42
    
@Mark Szymanski you need to follow that guide after you install it to the USB key. You should boot up Arch Linux as a LiveCD in VirtualBox, follow the normal routine to install it on your USB key (e.g. add it as a virtual device), and then follow that duplicate question I posted. There's no difference. If you can't get Arch to detect your USB key, install it from a different Linux distro. –  Breakthrough Aug 19 '11 at 0:13
add comment

3 Answers

up vote 4 down vote accepted

Virtual box can boot physical USB Flash Drives.

Maybe this this tutorial will help you. http://agnipulse.com/2009/07/boot-your-usb-drive-in-virtualbox/

share|improve this answer
    
Will test when I get the chance. Thanks! –  Wuffers Aug 20 '11 at 0:29
    
This worked, thanks! –  Wuffers Aug 20 '11 at 22:59
add comment

The VirtualBox BIOS doesn't allow you to boot from USB.

However, you can use a product called the Plop Boot Manager to work around this. Plop comes with a bootable USB iso image that will detect a bootable USB device in a Vbox vm.

Using this method, I'm able to boot an OpenBSD usb stick that I have, but I need to configure Vbox for USB v1.1 instead of 2.0. It may be possible to work around this... I just haven't needed to do so.

share|improve this answer
add comment

I still don't think it is entirely clear what you are trying to do. It is very helpful if you use the words guest and host in your question as to help clarify what exactly you are talking about.

First - read up on how virtual storage works and what options are available to you in the online manual, chapter 5: http://www.virtualbox.org/manual/ch05.html

Second - clearly you want to install at least one operating system to your USB media, and really if you are installing the host and the guest to the USB media, it is a bit beyond the scope of this question. But once you have the host installed (wherever it is going to be) - it appears the guest will definitely be installed on the USB drive.

You had mentioned specifically you don't want to have a virtual disk file sitting on the drive, so I am guessing want the entire drive to function as a virtual drive. There is a special type of virtual disk called a "raw hard disk". You will still need a VMDK file sitting somewhere that tells VirtualBox which partition to use in RAW mode, so you may want to actually partition the flash drive. This may also be problematic depending on your host as the physical path to the drive/partition can change depending on how your storage is initialized (in particular, the order) - when you set this up, your flash drive might be /dev/sdc but next time you boot (or use it in a different computer) your drive might show up as /dev/sdb. Chapter 9 talks about the raw format in more detail: http://www.virtualbox.org/manual/ch09.html#rawdisk

It would be very helpful to help state your goals or what constraints you are working with to drive you to wanting this type of setup. Right now the best we can offer is some general advice, make assumptions about it and hopefully steer you down the right path. I considered flagging this question because as it is originally stated it just isn't answerable - but I do think it is salvageable with a little more input from you.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.