Boot and Run Ubuntu From a Flash Drive




Running an operating system, like Windows, off of your flash drive can be very useful sometimes. You can recover your data from a hard drive and copy it to an external hard drive if that computer won't boot up or scan that computer for viruses and so on... This Instructable will show you how to install, boot, and run the popular Linux distro, Ubuntu from your flash drive. You will be able to automatically save your changes and settings back to the flash drive and restore them on each boot using a second partition.

You can run Ubuntu will all your settings and files, even if you don't have your own computer with you. You will have a whole, powerful operating system in your pocket!

Sorry for the not very helpful pictures. It was to hard to document each little step for each step. Hopefully it is still easy to follow...

I'm not liable for any damage done to your computer and/or flash drive. However, I haven't ever had a problem. Just make sure to follow each step carefully.

*This process is no longer needed as of Ubuntu 8.10 because a USB Ubuntu Creator is built in.

Step 1: Get Materials

Here are the materials needed:
  • USB 2.0 Flash drive (at least 1G) (You could use USB 1.1, but everything will take 5x longer)
  • Computer w/ CD Drive (Must be able to boot from USB. Newer motherboards will work. Motherboards older than 2 years old probably won't work. A BIOS update from your computer manufacturer might work.)
  • Ubuntu LiveCD (You don't need this if your computer already has Ubuntu installed on it)
  • You should also be somewhat computer-savvy and comfortable with command prompt/ terminal.

I used a 4GB Sandisk Cruzer Micro and Ubuntu 7.10 (current one at time of writing)

You can get the Ubuntu LiveCD at Download the Ubuntu Desktop LiveCD iso and burn it on a CD using Nero or another program. You could also request a free Ubuntu CD but that takes 6-10 weeks to ship.

Step 2: Changing BIOS Boot Order

We will need to change the boot order of your BIOS throughout this Instructable. Turn on your computer and while it turns on press the button to access the BIOS Setup Utility. Usually F2 or Delete. Navigate around the setup until you find something about the boot order. You can change it so if that first device is their, it will boot up from that device. If the device isn't their, it will keep going down the order/list until their is one with that device plugged in.

Also, when you boot up you might have an option to temporarily boot up from a certain device. You could use this if you want to only boot up from a device once.

Step 3: Boot From the Ubuntu LiveCD

Once you have Ubuntu, turn off your computer and stick the CD in it. Turn on you computer and setup the BIOS to boot from the CD. It will load and then you will see Ubuntu!

You can skip this if your computer has Ubuntu installed on it. Just turn it on and log in.

Step 4: Format the Flash Drive

Now that you're in Ubuntu, it is time to format the flash drive. We will make two partitions, one for the actual Ubuntu OS, and another to automatically save your changes and settings back to the flash drive and restore them on each boot. You can also store personal data on the second partition.

Backup all your data on your flash drive before doing this. This will erase all your files on you flash drive

0. Backup the data on your flash drive.

1. Open Terminal, under Applications

2. Type in "sudo su"

3. Type in "fdisk -l", and identify which device is your flash drive. Mine was "sdb". Whenever I type "sdb", put in your flash drive identification. For example, if your flash drive was sda, and I typed "format sdb1" then you would type "format sda1".

4. Type "umount /dev/sdb1"

5. Type "fdisk /dev/sdb"
  • type p to show the existing partition and d to delete it
  • type p again to show any remaining partitions (if partitions exist, repeat the previous step)
  • type n to make a new partition
  • type p for primary partition
  • type 1 to make this the first partition
  • hit enter to use the default 1st cylinder
  • type +750M to set the partition size
  • type a to make this partition active
  • type 1 to select partition 1
  • type t to change the partition filesystem
  • type 6 to select the fat16 file system
  • type n to make another new partition
  • type p for primary partition
  • type 2 to make this the second partition
  • hit enter to use the default cylinder
  • hit enter again to use the default last cylinder
  • type w to write the new partition table

6. Type "umount /dev/sdb1", then "umount /dev/sdb2".

7. Type "mkfs.vfat -F 16 -n Ubuntu /dev/sdb1". This formats the first partition.

8. Next, type "mkfs.ext2 -b 4096 -L casper-rw /dev/sdb2", to format the second partition.

9. Exit terminal, then unplug your flash drive.

Step 5: Install Ubuntu to the Flash Drive

Now that you have finished formatting the drive, you can now install Ubuntu onto the flash drive partitions.

1. Insert flash drive.

2. Open Terminal.

3. Type "apt-get update".

4. Go to Ubuntu Packages and download Mtools and install. Afterward, download Syslinux and install.

5. In terminal, type "syslinux -sf /dev/sdb1".

6. Type "cd /cdrom"

7. Type "cp -rf casper disctree dists install pics pool preseed .disk isolinux/* md5sum.txt README.diskdefines ubuntu.ico casper/vmlinuz casper/initrd.gz /media/Ubuntu/".
  • Ignore any "cannot create symbolic link" errors.

8. Go to first partition of the first flash drive and rename "isolinux.cfg" to "syslinux.cfg".

9. Edit "syslinux.cfg" so that it looks like the attached text file.

Finally... You are done!

Step 6: Conclusion

Now you're done! Just reboot the computer, set it to boot from the flash drive in the BIOS, and let it load!

If your can't get Ubuntu to boot, your flash drive may have a corrupted MBR. To repair the MBR of your USB device, at the terminal in Ubuntu type "sudo apt-get install lilo " followed by "lilo -M /dev/sdb".

You can now run Ubuntu anywhere and still have all your settings and files.



    • Frozen Treats Challenge

      Frozen Treats Challenge
    • Pets Challenge

      Pets Challenge
    • Beauty Tips Contest

      Beauty Tips Contest

    127 Discussions


    3 years ago

    It's much easier than that.

    1. Download Rufus (google for it)
    2. Download the Unbuntu desktop iso (google that too)

    run rufus with your pendrive plugged in, select the unbuntu ISO as source for the bootable disc. Press 'Start'. Done.

    Don't forget to press F12 or whatever key is needed to get your pc into the boot selector. In some configurations you may have to enable the menu in the BIOS.

    1 reply

    Reply 3 years ago

    No... that makes the USB boot to the Ubuntu setup, which installs Ubuntu on the computer.


    Reply 3 years ago

    hi rohit9999, IMHO this instructions is outdated for a while, try using the instruction on

    Basically, u need to download the ubuntu iso, burn it to a DVD

    boot it your laptop/computer from the DVD

    create a ext4 journaling file system using min 7G (or all the usb space - the swap space(use in next step)) and mount as /

    create a swap space using the swap space reserve in previous step.

    then install the OS on the USB stick

    last, try boot using the USB


    11 years ago on Step 5

    Hello...great tutorial, but I am stuck on Step 7. I'm running Ubuntu 7.10 now and do not have a CD drive. Do I still execute "cd /cdrom"? When I execute the command in step 7, the cursor moves down to the next line and then...nada. I completed the rest of the steps with no problem. Can you help me? Cheers and great work!

    7 replies

    Reply 4 years ago on Step 5

    Try doing what I'm doing. As I write this I am running Ubuntu 14.04 and I just grabbed a .iso of it and put it on a USB drive. Then I booted from the USB drive, plugged another 16 gig thumbrive into my second port and ran Ubuntu setup on that. More complete instructions can be found on the Ubuntu forums.


    Reply 11 years ago on Step 5

    I tried it again, both in 'cdrom' and in root: This is what I get. cp: cannot stat `casper': No such file or directory cp: cannot stat `disctree': No such file or directory cp: cannot stat `dists': No such file or directory cp: cannot stat `install': No such file or directory cp: cannot stat `pics': No such file or directory cp: cannot stat `pool': No such file or directory cp: cannot stat `preseed': No such file or directory cp: cannot stat `.disk': No such file or directory cp: cannot stat `isolinux/*': No such file or directory cp: cannot stat `md5sum.txt': No such file or directory cp: cannot stat `README.diskdefines': No such file or directory cp: cannot stat `ubuntu.ico': No such file or directory cp: cannot stat `casper/vmlinuz': No such file or directory cp: cannot stat `casper/initrd.gz': No such file or directory


    Reply 11 years ago on Step 5

    yeah, eventually, I figured that out. A few hours later, I got it sorted out. Cheers.


    Reply 9 years ago on Step 5

    I'm having the same problem. I got everything to work up until that point, but when I do step 7, the cursor goes to the next line and nothing happens. I tried it a few times, and right now I can hear the disc drive going nuts, which didn't happen before. Any ideas?


    Reply 9 years ago on Step 5

    okay, I think I fixed that. turns out I needed to do "cd /media/cdrom" for step 6.

    So I did it and now there are a bunch of files on my drive. I edited isolinux.cfg (by the way, the original was like five lines long and looked nothing like the new version) and booted into OSX to change the boot order. However, my flash drive doesn't show up in the available disks for startup.

    If it helps, I'm doing this in system preferences --> startup disk and am dual booting ubuntu and OSX. I followed all the steps in ubuntu, of course.


    6 years ago on Introduction

    I've got the ubuntu disc and a flash drive to tell you the truth i don't know what i could use it for what uses can it render on my computer what programs can i run with it ?


    7 years ago on Introduction

    would this work on a 2gb memory stick
    and if i download ubuntu from the site do i still need a live cd thanks in advance


    10 years ago on Introduction

    for part 4, if you have windows could you do that step in it? i no you can format it, but can you partition it?

    4 replies

    even better, install ubuntu fully directly to your usb, no hacks or 3rd party software, ubuntu has the option to install to a usb flash/hard drive and it runs fine, just make shore that you select your usb drive for boot loader and installation and swap space if use and volla! ubuntu on usb