The aims of this specification include using a 1GB USB flash drive as the boot media for a Live or installed Ubuntu base.


CD and DVD media are becoming outmoded. USB flash drives are used now for "bigger than floppy" file portability; and data backup is slowly moving towards USB hard drives. These media each have the advantage of being random-access rewritable, instead of one-write or append/erase; as such, they are an attractive alternate to CDs for live booting, and may store persistant session data.

Scope and Use Cases

It should be possible to install and boot Ubuntu from a USB storage drive in the same way as from a regular hard disk or LiveCD. A static Live system booted from a USB flash drive or hard drive will be referred to as a "LiveDrive" here.

There are two main modes we should consider:

  • LiveDrive: The Ubuntu LiveDrive should be capable of booting to a static environment identical to a LiveCD boot, with all activity occuring in RAM.

  • Portable: The Ubuntu LiveDrive should also be capable of booting into a portable system acting as an Ubuntu installed base. This system should retain the changes made to the system across boots.

The RapidRestore specification (currently JohnMoser/RapidRestore) should be used to allow any Portable install to also function as a LiveDrive; and also to save space, as the base install can be a compressed SquashFS image.

We should consider that a 1GB USB drive will be the smallest a LiveCD image fits on; and a 2GB USB flash drive will be the minimum for a straight installed system. Because the compressed LiveCD file system fits in about 500MB, a 1GB drive can feasibly be used with a strong dependency on JohnMoser/RapidRestore.

On-line discount stores sell such USB flash drives for $100 (1GB) or $170 (2GB), so this is financially feasible (2006). By now (january 2007) you can get a 1GB drive for as little as $20 and 4GB for $75 !!

Use Cases:

There are many. All of these assume that the portability of a USB flash drive, which is usually hung around the neck or on a keychain, is an asset that leads to it always being on hand.

  • Alice wants to do an impromptu demonstration of Ubuntu Linux to Bob, and so allows him to use the LiveDrive mode on her USB stick.

  • Alice is at a college computer lab and wants to browse the Web and check her e-mail.
  • Alice wants to e-mail Bob an encrypted message from a public terminal, and so uses G-Mail through SMTPS with Thunderbird/Enigmail.
  • Bob wants to install Linux, but shares his machine with his parents and so cannot install a boot loader or extra hardware.
  • Alice wants to install to hard disk, but also always have a LiveCD system ready to run for emergency recovery.

Implementation Plan

Implementing the UbuntuLiveDrive relies on RapidRestore and BootFromUSB.

The UbuntuLiveDrive should be implemented as a RapidRestore installation. RapidRestore would utilize a SquashFS image on a base root partition, base_root; and a JFS or similar overlay root partition, overlay_root. This has the same implications with /boot and /home as in RapidRestore.

It would be important that this system could BootFromUSB. Installation to internal hard drive in this manner would not require BootFromUSB; however, much of the appeal of the UbuntuLiveDrive is its functionality as a portable system.

The actual implementation would be an installation by a Linux or Windows script. This script would draw a GUI which would ask a user to chose a detected USB device and help it with partitioning.

If the device only has a single partition, the GUI will ask how much space to leave on the device. This would be accompanied by a minimum value restricted by how much data is currently on the device; and a maximum value restricted by the amount of space needed for a proper UbuntuLiveDrive installation. This will be a fairly common scenario; effectively, it is a shrink of the USB drive to accommodate UbuntuLiveDrive.

The script will also ask how much room to give for system growth; and for user files and settings. The UbuntuLiveDrive will use a fixed amount of space for the SquashFS image of the LiveCD base system; 50M or 100M for /boot; and the remaining space for the overlay_root and for /home. Swap files will be used for swap.

After the script is finished querying the user, it will proceed to resize the existing partition(s) and install the necessary files to the drive. The LiveCD SquashFS root image will be used for the base of the UbuntuLiveDrive, with /boot copied to a separate partition.

Swap files will be used instead of a swap partition, and will be stored in /SWAP on the union between base_root and overlay_root (which is seen as just /). This is so when the RapidRestore functionality is used to make a backup, /SWAP can be cleared. Swap is feasible because NAND chips in USB flash drives use hardware wear leveling and can be written 1x1018 to 1x1028 times. The purpose of swap is first to prevent OOM killing when memory usage spikes briefly, and second to let the kernel more efficiently manage disk cache.

The UbuntuLiveDrive would by default boot to a Portable system. In this mode, changes are made persistent by backing the read-only base_root with a writable overlay_root on physical media. For reference, the UbuntuLiveCD backs a read-only base_root with a writable tmpfs overlay_root, which is lost when the system is shut down.

The UbuntuLiveDrive would be capable of booting into a LiveDrive system. In this mode, the base_root is used as the seed for a live boot similar to the UbuntuLiveCD. Changes are lost on shutdown.

The UbuntuLiveDrive would need to use UbuntuLiveCD facilities in its entire lifetime. This means that even when upgrading the Portable UbuntuLiveDrive system, it still must do UbuntuLiveCD style X and hardware detection. In particular, X must be reconfigured at each boot. Users, groups, and passwords are persistant.

Implementation Process

Data Preservation and Migration

  • It should be possible to resize existing VFAT partitions non-destructively on USB flash drives and hard disks.

Packages Affected

User Interface Requirements

  • Windows and Linux scripts with UI components to perform a simple installation

Outstanding Issues

JohnMoser/UbuntuLiveDrive (last edited 2008-08-06 16:41:46 by localhost)