Making Live USBs

I’ve had some adventures in making live USBs recently. Here are some lessons learned and some tips and tricks to extend the standard USB.

I started with the Ubuntu installation candidate. I wanted to make a live USB that had a bunch of bioinformatics software on it for a class I was teaching. I grabbed the current version (13.10/64-bit) but you should use whatever is available.

I also have a set of 16 gb USB drives. I like the ADATA USB 3 drives, but you should go with what you have. However, I wanted to partition my drives so that I have a partition for the Ubuntu installation, and a partition for other stuff (documents, photos, etc). I used gparted to create my partitions, made them both FAT32, and set up labels for each. Set the first partition to be 6 gb – this is where you will install the operating system and a persistence file (4 gb) for your software.

Installing linux on one of the partitions was a breeze using the startup disk creator in Ubuntu. However, here’s where things get interesting.

First, I had a list of ~200 pieces of software that I wanted to install from the debian repository (you can see the full list here). I tried just installing all of these, but that didn’t work – my 4 gb hard drive filled up pretty quickly, and worse, the computer was slowed down because of memory constraints (I think). So I manually installed them, choosing to install packages that (a) had a lot of dependencies (e.g. bioperl) and (b) other things depended on (e.g. bioperl) first.By limiting the maximum number of files that I installed at a time, by a surreptitious use of apt-get, and by frequently removing files in /var/cache/apt/archive, I successfully downloaded and installed all the files.

Copying the installed system

If you want to duplicate the USB disk, there are two ways to do that:

  1. Use dd:
    •  insert the disk, and unmount the partitions. Then use dd if=/dev/sdx of=bioubuntu.img to make an image of the whole disk using dd. You will need to change your /dev/sdx to the appropriate device (e.g./dev/sdb or /dev/sdc). 
  2. Copy the casper-rw file
    • The file system is stored in a persistence file called casper-rw. The reason that the operating system is limited to 4gb is that FAT32 (which your thumb drive surely is) can only handle files that are upto 4 gb in size.