How to run Linux from a USB drive

4. Speed

The simple rule here is "pay more, get more". Companies such as OCZ and Corsair specialise in high-performance devices – Corsair even makes a special range of flash drives (known as 'GT') that are made from extra-fast components. Remember, your entire computer will be running from this tiny device, so only go for a slow drive if you're a very, very patient person.

5. Size

Arguably the least important consideration is the actual physical size of the flash drive. This isn't usually a problem because all flash drives are necessarily small, and it's only if you're after a particularly tiny one that you even need to consider this. SanDisk's Cruzer Micro and Corsair's Flash Voyager Mini both come in 4GB and 8GB capacities, despite being less than half the size of conventional drives.

Make your choice

There are two distinct ways of running Linux from a flash drive, but we'll only be covering one of them here – and for good reason, as you'll see.

The two ways are: using your flash drive as a Live CD, and using the drive as a full Linux install. Perhaps surprisingly, the first option is the better one for several reasons:

  • Live CDs scan the hardware at boot time, and so are likely to be compatible with the most machines.
  • Live CDs must by necessity have a small footprint, which means there's more space for your files – or you can just buy a smaller, cheaper drive.

  • Live CDs run as much as they can in RAM, which makes for better performance.
  • Live CDs don't use swap.

That last point is actually the most important one of all: Linux makes extensive use of hard drives to save temporary data, and if you treat your flash drive as a real hard drive then Linux will use it for swap, too.

The problem is that flash drives, like all flash memory devices, have a limited number of times they can be written to before they fail. Most drives are able to withstand 100,000 writes to every memory sector, but the best can handle up to 1,000,000 and often automatically balance writes to ensure that no one sector gets excessively worn out while others are sitting untouched. Again, this is a reliability factor, so if you care for keeping your data intact for a long time it's worth you buying a trusted brand.

Just how fast is it?

As fast as flash memory is compared with mechanical hard disks, it's still limited by the throughput of USB. But on the upside, the lack of swap availability means that Linux will take advantage of your RAM much more, which means the most commonly accessed data will be just as fast if not faster when using USB drives.

If you're used to using a Live CD, you'll also be pleased to know there's much less noise (the triple-digit decibel whir of a busy DVD drive is, of course, absent with flash drives), and there's also none of the latency that usually happens when the OS lets the DVD drive go idle.

On the flip side, the nature of Live distros means they must detect their environment during boot up, so expect boot times to be a bit longer.

Do it with Ubuntu

Ubuntu 8.10 doesn't contain much in the 'wow' department, but it does come with a USB installation wizard as standard. This works by mimicking the Casper system of running a live operating system from read-only media – with the exception that flash drives aren't read-only, so you can actually make changes to the OS.

Even after Ubuntu is installed to your drive, it still looks and feels as if it works in Live mode, so you'll be prompted to choose a language when it boots up. This might seem like an annoyance, but it does come with the added bonus that the Ubuntu hard disk installer is always within reach – you can use your flash drive as an Ubuntu installer on as many PCs as you want.

Make these changes