Recently I have got a shiny and beautiful Chrome finished, shiny Transcend 8GB USB flash drive. What did I first think to do with it? Put Ubuntu on it, of course ;) There are many ways to create a live USB drive carrying an operating system like Ubuntu, but the method I will describe further is mainly based on using SUN's VirtualBox. For those who don't know what VirtualBox is visit this Wikipedia link. While the method described on the Ubuntu documentations implies installing a Live CD image on a USB flash drive, which would then need to extract and load the operating system in the RAM, the method that I will describe on this page implies installing a fresh operating system on a bootable flash drive that will work the same way as from a real HDD (except the speed, of course). Thus, you should have a good bootable USB 2.0, with decent I/O data processing speeds, with at least 4GB (considering that the operating system itself weighs ~2GB, Karmic Koala).

Divide your USB flash drive into two partitions

In order to separate the operating system from the documents you would like to save on the flash drive, it is advisable that you divide your USB flash drive into two partitions. Only do this if your USB flash drive has more than 2GB of space and you do not need to save changes you make inside the operating system. In order to achieve this, you need to have GParted installed (or at least this is what i prefer). If you are not following this tutorial on a Linux machine, then you'll have to use whatever software you best know that works with your operating system (on Windows I recommend Acronis Disk Director and Partition Magic). To get GParted type the following command in a terminal:

sudo apt-get install gparted

Now backup all data you have on your USB flash drive, because we will need to format it and create two partitions. Haven't backed up your data? You're playing with fire! Open GParted from System>Administration>GParted You now see the window of GParted application. Select your USB drive device from the drop-down list in the top right corner:

GParted Ubuntu selecting device

Double check that you have selected the correct device (mainly by verifying the device's total space), or you might format and lose data on a wrongly selected device. Now that you have selected the correct device, unmount it, otherwise you will not be able to perform any actions on it.

Unmount it from GParted as below:

Unmount device from GParted

Now delete your partition. If you have more partitions and would like to use all the space on your USB flash drive, then you will need to delete in partition in part. Delete a partition as below:

Delete paetition in GParted

Your partition is not yet deleted! You need to confirm this action. Confirm it by clicking on the green tick as below, and click "Apply" when asked again:

Confirm changes in GParted

Now we will create two new partitions: one for installing Linux Ubuntu, the other for saving other files. Also note that Windows will only recognized the second partition which will be formatted in FAT32. Select the "Unallocated" partition, right click on it, and select New. Do as below:

Create new partition GParted

We will now create the first Windows compatible partition for saving files. Change the New size field to a value that will be the space allocated to saving files. Remember that the Linux Ubuntu installation requires ~2GB for a full installation and at least 1GB of space for operating. I put here the value 3000 (remember that this is in megabytes). GParted will now automatically calculate the Free space following value, so don't change that manually. Now make sure that Create as has Primary Partition selected, and the File System has FAT32 . Give a new name to your USB Flash drive in the Label field. Overall, your window should look like this (the Free space following and Label values vary depending on your USB flash drive):

Create new FAT32 partition

Now right click the unallocated partition again, and select New:

Create new partition

Now we will create the Linux partition for the new operating system. Leave everything as is, change only the File system to ext3 and name your Linux partition:

ext3 linux partition

Now click the green tick to commit the changes. Wait some time until the USB is partitioned and formatted. After everything finishes, close GParted. Now open VirtualBox. You will need to create a DOS virtual system in order to install Ubuntu on your USB. Click the NEW button and follow the instructions to create the DOS system:

Create new system in VirtualBox

IMPORTANT: You need to allocate 384MB of memory or more (preferably 512MB) to your newly created system in order to be able to install Ubuntu on your flash drive:

Allocate memory to DOS in VirtualBox

You will now need to download the latest iso from Ubuntu. I suggest you download the 32 bit version if you want to be able to use your operating system on computers that are not 64 bit enabled. After you have downloaded the iso from Ubuntu, return to VirtualBox and select File > Virtual Media Manager and select the CD/DVD Images tab. Now add the Ubuntu iso that you have just downloaded to the list of images loaded on boot and then click OK:

Virtual Images Manager VirtualBox

Now right click on your DOS system in VirtualBox and select Settings:

VirtualBox DOS settings

Now select Storage from the left list of menus:

VirtualBox settings storage

Now click on the Add CD/DVD device (represented by a cd with a plus sign). You should see that your CD/DVD/BluRay drive has been added to the list below:

VirtualBox Add CD/DVD Device

Select your CD/DVD/BluRay drive that has been just added to the list, and select the Ubuntu iso from the CD/DVD device dropdown menu:

VirtualBox add Ubuntu iso

Also make sure that both USB controller and USB 2.0 controller are enabled in the USB menu and then click OK to close the Settings window:

VirtualBox USB enabled

Now go back to the main VirtualBox window and start your DOS system:

Start system VirtualBox DOS

Your DOS system should automatically boot from the Ubuntu iso. If it says that it cannot read from boot medium you will need to restart DOS and click F12 while loading to chose the Boot from CD booting source. Now that you see the Ubuntu iso loaded, you should plug in your USB flash, wait a little bit until it is detect by your host system, then click to use it within DOS as below:

Load USB

Then with your UP/Down keyboard keys select to install Ubuntu. Go through the wizard and choose your proffered settings until you are asked where you want to install Ubuntu. Choose to Specify partitions manually (advanced) and click Forward:

Specify partitions manually

GParted will analyze your drives and show you your USB disk drive. Right click on the partition which was formatted in ext3 and choose Change:

Change partition ext3

From the new window choose Use as > Ext4 journaling file system, and make sure that Format the Partition check-box is selected:

Use ext3 journaling file system

From the same window choose the Mount point > / then click Ok: After finishing doing the above mentioned instructions click on Forward and finish with the rest of settings that the Ubuntu installation will ask you. Now wait until the installation finishes (depends on your USB Flash write speed):

Ubuntu installation progress

When the installation finishes,exit VirtualBox and select System > Administration > Disk utility :

Open Disk Utility

From the disk utility browse to your ext3 partition from your USB drive, select it and in the adjacent window check the Bootable option in order to make your USB device bootable. Now restart your computer and your BIOS settings and choose to boot first from your USB Flash Drive. Enjoy your fresh portable version of Ubuntu!