How To Run Linux From A USB Flash Drive
From Installation CD To Bootable Flash Drive
Most Linux distributions, such as Ubuntu, are capable of installing directly to a USB drive as if it were just another hard drive, but some distributions treat USB flash drives as a slightly special case. DSL, for instance, has an installer specifically for creating a USB-drive installation of the OS. Puppy can also install itself directly to a flash drive through the built-in Universal Installer utility. However, the default options did not work in my case; I had to explicitly use the "SysLinux" option in its installer menu to make the flash drive bootable.
In all cases, a USB flash drive will be mounted and recognized as a virtual SCSI device, such as /dev/sda or /dev/sdb. If you're performing the installation on a system that already has a hard drive present, pay close attention to the devices listed in the partition manager, and make sure you're installing to the right device. Otherwise you might accidentally wipe the hard drive -- although the device size should be a big tipoff! Also make sure that the installer makes the target device bootable and writes a proper master boot record to the drive, although most of the time this should happen automatically.
From Live .ISO To Bootable Flash Drive
![]() | |
| Open source QEMU lets you run Linux in a virtual machine on top of another OS. | |
| (click for image gallery) |
If the edition of Linux you're eyeing has a live CD distribution (and most of them do), it's also possible to mount the .ISO for the live CD on a flash drive and run it from there. The advantages of doing this should be plain: it's a lot faster to run a live distribution from a flash drive than from a CD, and almost any machine that can boot from a CD can also boot from a flash drive as well.
The disadvantage of this type of setup is that, by default, a live CD distribution is generally not persistent. Any changes made to the system will be lost the next time you reboot, unless you make specific provisions to save user data. Some live distributions allow this, but it's not always guaranteed. On the plus side, if you want a live distribution that doesn't leave behind any traces -- for instance, for secure browsing or system recovery -- this is a perfect choice.
The folks at PenDriveLinux have created scripts to automate the process for a number of popular distributions such as Ubuntu 8.04 and PCLinuxOS. Their trick (and it's a clever one!) is to use the open-source 7-Zip archiving application to browse the .ISO and extract key files from it to allow SysLinux to make the drive bootable.
The same basic techniques can be applied to any Linux that runs from the ISOLINUX live file system. To that end, if you want to make a bootable flash drive from a live CD distribution's .ISO, follow these steps:
- Format your flash drive. You may need to first use DISKPART CLEAN as described above. For the sake of compatibility, use FAT or FAT32 as the file system. (FAT seems to work best.)
- Use 7-Zip or another .ISO reading tool to unpack the entire contents of the .ISO onto the flash drive. Make sure the root directory of the .ISO corresponds to the root directory of the flash drive; don't unpack the contents into a subfolder on the flash drive.
- Use SYSLINUX -ma <driveletter>: (in an admin console, if you're using Vista) to write the system files, with <driveletter> being the drive letter for the flash drive. If you're running SysLinux from something other than Windows, the -ma switches aren't needed.
- With many live distributions, there will be a file in the root directory of the drive labeled ISOLINUX.CFG. This may need to be renamed to SYSLINUX.CFG to make things work correctly.
- Unmount the flash drive and try to boot it on your target system.
Some live Linux distributions will have a \boot directory off the root directory in the .ISO, usually with an \isolinux directory in it as well. For such distributions, you'll need to move the contents of \boot\isolinux to the root directory of the flash drive before renaming files and then applying SysLinux. The order of the events is crucial.



