Radu Cotescu's professional blog

g33k w17h pa45510n

Booting Ubuntu From an USB Stick

Booting Ubuntu from an USB stick is both fast and convenient: fast because an USB stick definitely has better R/W speeds than CDs, convenient because you can alter those files for how many times you want without buying several storage mediums (you could use a CD-RW, but that still would be slow). Nowadays USB sticks have become cheaper and offer much more GB/$ than they used to, so it’s not unusual to find affordable flash pens with 2+ GB storage space. Considering that an Ubuntu LiveCD has about 700MB, putting that on a 2GB flash pen will leave you with almost 1.3GB unused space. Wouldn’t that be a shame?

Of course, USB sticks can have multiple partitions (but not on Windows - and guys & girls, this is a feature, not a bug). While using your pen’s 2 partitions wouldn’t be a problem on Linux, this certainly is a debatable subject on Windows. Let’s make it clear: Windows only sees the first partition of a removable drive. What’s the solution if you want to use your USB stick for storage too?

How to

My stick for this job is a 4GB Patriot Xporter XT Boost, which is a pretty fast beast. I am assuming that you are working with Ubuntu (installed on your machine or running from a LiveCD, the differences are minimal). The tools used for the job are GParted and Ubuntu Live USB Creator. While the latter comes by default in Ubuntu, the former is only present on the LiveCD but can be installed easily:

sudo apt-get install gparted

The first step consists of creating the necessary partitions on your stick. Insert your stick to an USB port and open GParted (System » Administration » Gparted). Now select your USB pen (on my machine this is /dev/sdg) and delete all the available partitions. After this your stick should look like in screenshot 1.

[caption id=”attachment_1313” align=”aligncenter” width=”300” caption=”GParted Unallocated Space”]GParted Unallocated Space[/caption]

Next you have to create the STORAGE partition and then the UBUNTU partition (screenshots 2, 3 and 4), where the UBUNTU partition should have about 714MB.

[caption id=”attachment_1314” align=”aligncenter” width=”300” caption=”GParted - creating the STORAGE partition”]GParted - creating the STORAGE partition[/caption]

[caption id=”attachment_1315” align=”aligncenter” width=”300” caption=”GParted - Creating the UBUNTU partition”]GParted - Creating the UBUNTU partition[/caption]

[caption id=”attachment_1316” align=”aligncenter” width=”300” caption=”GParted - final partition layout”]GParted - final partition layout[/caption]

Then start Ubuntu Live USB Creator (System » Administration » Startup Disk Creator). Select your Ubuntu image/CD and from the partitions listed in the bottom frame select the one labelled UBUNTU (if your stick appears like /dev/sdg, this partition should be /dev/sdg2). By using the second partition for Ubuntu you assure yourself that you can use your stick for storing files on the first one using Windows machines (this also protects your second partition against accidentally being written by a Windows user). Once you’ve made these choices, click on Make Startup Disk and wait for the process to finish.

[caption id=”attachment_1317” align=”aligncenter” width=”300” caption=”Ubuntu Live USB Creator”]Ubuntu Live USB Creator[/caption]

To boot a machine using your newly created Live stick, change the BIOS settings accordingly. This can vary from selecting the first boot device to be a Removable one, or setting your first hard disk to be your flash pen (this depends on the system to be booted). Now not only that you have a stick from which you can boot and install Ubuntu in a breeze, you also can use that extra space for platform independent storage.

How To, Ubuntu

« Automated cPanel backup OpenOffice.org 3, Ubuntu and Romanian fonts »

Comments