Ubuntu Full Install to USB

John C. Lusth

Revision Date: January 19, 2012

Printable Version


Introduction

This is a guide for performing a full install of Ubuntu on a USB Flash Drive. Care is taken to reduce the number of disk writes because the number of writes to a flash memory cell is limited.

Step 1

Boot your computer off an Lucid Lynx Ubuntu Live CD or use unetbootin to create a Live USB stick. Answer questions as appropriate until you get to the point where you are asked how to partition the disk. Select the "use entire disk" option. Make sure you select Manual mode and make sure you select the USB Flash Drive. Otherwise, you may overwrite and destroy the data on your main hard drive.

Proceed with the install.

Step 2

In the manual mode, click on any partitions available and delete them. The partitions will be named sdb1, sdb2, etc., although the letter `a' may be replaced by a some other letter (`c' for example), depending on your setup.

What should be left is free space.

Step 3

Click on the free space item and click on New Partition. Give the partition a size that is about 2% less the the available capacity. Select ext4 as the file system type and select the mount point as /. If you really want the drive to last, then choose the ext2 file system; ext2 will reduce the number of writes as compared to the journaling file systems ext3 or ext4. However, the performance hit for using ext2 is noticeable.

Click on Continue. You will be warned that you do not have a swap partition. You do not want a swap partition since swap is heavily written to and having one will quickly burn out your USB flash drive.

Click on Continue.

Step 4

You will be given a summary of your partitioning and will be asked to continue. Before you do, click on the Advanced button and make sure that grub will be installed on your USB drive. If you neglect to do this, grub may be installed on your main drive and you will only be able to boot your computer if the USB drive is inserted. You probably do not want this behavior.

Step 5

Finish the install.

Step 6

Reboot and set your bios to boot USB drives first. With your USB drive inserted, you should now be able to boot off of it.

Step 7

Once booted off of the USB drive, you will need to tweak the system to reduce the number of disk writes further. The main tweak is to disable the swap partition, if you have one. Please see configuration.html for more information.

Conclusion

Now, you should have a USB install of Ubuntu that should last significantly longer than it would otherwise. You should not let your computer set at idle for long periods when booted off the USB drive. You should not hibernate your computer since there is no swap space in which to save the state of your computer.

Always back up your data to a reliable location since you must assume your drive will die at any moment.

lusth@cs.ua.edu