Software // Operating Systems
04:21 PM
Connect Directly
Core System Testing: How to Achieve Success
Oct 06, 2016
Property and Casualty Insurers have been investing in modernizing their core systems to provide fl ...Read More>>

How To Run Linux From A USB Flash Drive

Want to run Linux any time, any place? Here's what to do with popular distributions like Puppy Linux, Ubuntu, and Fedora, so you can boot up directly from your thumb drive.

QEMU Linux

Some readers are probably familiar with using a virtual machine to run Linux on top of another operating system -- usually as a way to try out a given Linux distribution within Windows without creating a dual-boot scenario.

The same thing can be accomplished with a flash-drive edition of Linux, courtesy of an open source machine emulation package named QEMU.

It's small enough to fit on most flash drives along with whatever distribution you're using and can be started by executing a simple batch file. You'll even have networking support courtesy of whatever network is running on the host. Here's how to do this.

MokaFive lets you create bootable Flash drives that run any OS in emulation.
(click for image gallery)

  1. Format the flash drive as FAT or FAT32 (for the sake of compatibility).

  2. Copy the .ISO file you want to use to the root directory of the flash drive.

  3. Unpack the QEMU executable into a directory named \QEMU.

  4. Use the following command line to run QEMU from the root of the drive (you can turn this into a batch file):

    .\qemu\qemu.exe -L .\qemu -cdrom <name_of_ISO>

    There are a number of other options that can be passed. If you run QEMU without any command-line switches you'll see the full range of options available, so you can tune it to your needs.

  5. Run QEMU from within Windows. The emulated machine will appear in a Window and you can free the cursor by pressing the left Ctrl+Alt keys.

Keep in mind you're not going to see the kind of performance you'd get if you booted the system natively. QEMU does have a Windows-specific driver to allow some performance acceleration, but you can run it without that as well if speed isn't a priority.

If you want to create persistent storage on the flash drive, there are a couple of ways to do this. QEMU lets you mount any file as a hard drive, so one possible trick is just to create a large file on the flash drive that will hold your user data, use the -hd QEMU option to mount it as a hard drive, format the drive from within your live Linux session, and store your user data there between sessions.

The second option is more or less the same as the first, except that instead of just storing data on that drive, you actually install Linux on it and then set QEMU to boot the hard disk image instead of the .ISO. Note that the best way to do this would probably be to prep all the files on your PC first, then copy the hard disk image and the QEMU executables to the flash drive.

Finally, the folks at PenDriveLinux have created a package that you can use which contains QEMU and a batch file with some common options. The batch file can be customized with the command-line options you want to use, and you can make any other changes you see fit as described above.


Yet another way to run a Linux installation -- or, in fact, most any operating system -- from a flash drive is through MokaFive. This is a commercial application that lets you package virtual machines for redistribution across a network or -- you guessed it -- a flash drive. MokaFive uses VMware to perform machine emulation, which generally runs better than QEMU out of the box, and also allows for some fairly sophisticated lockdown techniques as well. The basic edition of MokaFive is free (although not open source), but will do nicely for this kind of work. You can even access hardware devices on the host computer, like scanners and printers (provided you have permission to do so).

The MokaFive toolkit includes the BareMetal player, a tool which lets you install a MokaFive VM to a flash drive, boot from it, and run it natively. A device with at least 2 GB of storage has to be available to make this work. Note that because the BareMetal player is protected against tampering, the only way to get a virtual machine into it is by loading one in through the BareMetal player's own interface.

Buy Linux Pre-Loaded

There's been speculation that you might eventually buy music on flash drives, and while that hasn't panned out the way conventional MP3 downloads have (barring the odd Nine Inch Nails flash drive left somewhere surreptitiously!), some Linux distributions have started to turn up on flash drives as preloads. Dragon Technology offers Ubuntu on a 4-GB flash drive for £21.95 (about U.S. $43), and the LinuxUK site has a range of USB Linux products at various prices. I've gone back and forth about whether or not we'll see software products routinely provided on flash drives -- the raw cost versus plain old CDs or DVDs is a lot higher, but in my mind the added versatility of the flash drive makes up for it.

4 of 4
Comment  | 
Print  | 
More Insights
Newest First  |  Oldest First  |  Threaded View
User Rank: Apprentice
11/15/2012 | 9:56:04 PM
re: How To Run Linux From A USB Flash Drive
Geez, talk about giving away all the tricks...

Something that should be considered are the security implications, as well as the data recovery opportunities, that having a USB flash drive that you can boot Linux up from introduces.

I created my first Linux Flash Drive a few years ago and have successfully used it in many instances to bypass security on boxes (all white-hat stuff, mind you) and to recover files from systems that would no longer boot before re-imaging them. That made a tool of this nature invaluable to me.
Register for InformationWeek Newsletters
White Papers
Current Issue
Top IT Trends to Watch in Financial Services
IT pros at banks, investment houses, insurance companies, and other financial services organizations are focused on a range of issues, from peer-to-peer lending to cybersecurity to performance, agility, and compliance. It all matters.
Twitter Feed
InformationWeek Radio
Sponsored Live Streaming Video
Everything You've Been Told About Mobility Is Wrong
Attend this video symposium with Sean Wisdom, Global Director of Mobility Solutions, and learn about how you can harness powerful new products to mobilize your business potential.