Using Portable-VirtualBox to run any OS from a USB device

Portable-VirtualBox allows you to run OSes from a USB drive, which helps you test them for use in server and desktop virtualization environments.

Oracle VM VirtualBox is open source software for server and desktop virtualization, which means that it can be

bent, shaped and reworked in many different ways. Portable-VirtualBox is one trick that lets you run an OS from a USB -- great for testing purposes or whatever else you need.

Oracle VM VirtualBox is included as a standard software package option in many Linux distributions (Ubuntu, for instance), and you can download and run it with very few restrictions. This means VirtualBox can be put to more uses than just running as a desktop application. The best example I've encountered so far is Portable-VirtualBox, a system for repackaging VirtualBox installations that allows a virtualized OS to be booted and run via VirtualBox from a USB drive. The best part is that you don't need a copy of VirtualBox installed on the host PC; VirtualBox runs directly from the drive.

Here's how to install and run Portable-VirtualBox, which allows you the flexibility of running any OS from a USB:

Downloading and installing Portable-VirtualBox

Portable-VirtualBox (P-V) works by downloading a copy of Oracle VM VirtualBox, customizing it according to your instructions, and then packing the resulting files for distribution on a USB drive or other portable media. When you run P-V, all the necessary kernel-level drives are registered and started automatically. When you close P-V, it unregisters everything and cleans up after itself. It's a little like a PortableApps version of VirtualBox.

More on Oracle VM VirtualBox

Setting up VirtualBox remote display

Recovering VirtualBox VMs

How to create virtual machines with Oracle VM VirtualBox

VirtualBox vs. VMware Workstation

To set up P-V, download the installer and run it. The installer is actually nothing more than a self-extracting archive, which you then unpack into a directory of your choice. Run the program and it will obtain a copy of VirtualBox from Oracle's site, which it then sets up in your directory. If you run the program and it finds a newer version of VirtualBox, you'll be prompted to upgrade. (It will back up the old version in case you discover that the new version doesn't work for you.)

The installer also includes options that allow you to use 32-bit and 64-bit versions of VirtualBox and that provide file compression to use less room on the target media.

When you run Portable-VirtualBox after its local copy of VirtualBox has been set up, it fires up the VirtualBox interface from the full product, but you'll notice a few changes. Press Ctrl+5 and you'll see a pop-up menu that lets you edit settings such as: launching a given virtual machine (VM) by default when the program starts, assigning hotkeys to the VirtualBox interface, starting VirtualBox with or without the USB or network support, and ignoring the "Check for a new version" notice at startup. The rest of Portable-VirtualBox behaves more or less as you would expect it to.

Nuances of Portable-VirtualBox

There are a couple of issues you could encounter with Portable-VirtualBox.

First, if you install P-V on a flash drive and run it from there, the speed of the drive will affect VM performance. Depending on the write speed of the flash drive, saving and restoring the state of the VM can take a very long time -- sometimes even longer than a clean boot of the guest OS. I used a flash drive with 5 MBps sequential write and 25 MBps read, and saving the VM state was agonizingly slow, but restoring it was many times faster than from a spinning drive.

Second, if you run the Portable-VirtualBox packager application on a system where Oracle VM VirtualBox is already installed, it may simply launch your existing edition of VirtualBox. Be sure to unpack and prepare P-V on a system where no copy of VirtualBox is already installed.

Other folks are finding clever ways to make Portable-VirtualBox useful as well. The makers of Linux Live USB, for instance, use P-V to allow Linux distributions to be packaged on USB drives so they can either be booted as a VM in Windows or directly from the USB drive on the host machine itself. The former approach is a great way to try out an OS without having to shut everything down first.

This was first published in September 2012

Dig deeper on Virtual desktop infrastructure and architecture



Enjoy the benefits of Pro+ membership, learn more and join.



Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: