Tutorial – Installing Linux to a USB memory Stick

Apr-9th-2009

Hi there folks,

Is it just me or is the idea of installing an Operating System to a USB pen just amazing. No matter how long I think about it, it doesn’t get boring. Laptops? Netbooks? If it’s portability you’re after, then how about an Operating System and all of you files in your pocket? Cool ! It’s a bit like planes – No matter how long I watch them for, I still wonder how they stay in the air… they go so slowly!

open_quote Tutorial

OK, so here’s my tutorial on how to install Linux onto a Memory stick. For this excercise, you’ll need a large USB stick – I have used a 16GB stick, but that is because I want to have my videos and music with me. An 8GB will do, and you’re pushing it at 4GB, which is only slightly larger than a basic Linux installation + OpenOffice, Firefox etc etc… Next, you’ll need a LiveCD of the Linux distribution of your choice. I used Fedora. See below for instructions. That’s it!

  • A USB memory stick with preferably at least 8GB capacity – they’re really cheap these days!
  • A Live CD of your favourite Linux distro
  • A computer to do the installation on

Step 1

Insert the USB stick into your PC. IMPORTANT: Make sure that there are no files on the USB stick, they will be lost. The intention for my USB stick is to have some space to store music and video that I can share with other people. Other people may not be using Linux, so we need to create an area (or partition) that will allow the other PC’s to see some area of the USB stick. So I opted to divide my 16GB USB stick into: 9GB Linux filesystem (ext3) and 6GB multi platform compatible (NTFS). Note FAT16 has a 2GB size limit, and FAT32 has a 4GB size limit. Luckily the NTFS support is now very good in the Linux world, so I opted for that. So on my PC, I used “gParted“, the Gnome disk partitioning application to make these partitions.

Partitioning the USB stick

So we can see that I have divided the 16GB into 8.79GB of ext3 and 6.15GB of NTFS. gParted is a great application, which I recommend to everyone.

Step 2

Once that is complete, the next instruction is to download the latest LiveCD image from the distro website. I wanted to install Fedora KDE onto my PC, so went to their website: http://fedoraproject.org/en/get-fedora-kde and downloaded the iso file.I then used k3b to burn the image to a CD:

write-disk

fedora_cd

Step 3

Once the CD is ready, reboot your PC, leaving the CD in the CD/DVD-rom. Also, make sure your USB stick is plugged in. When your PC starts up, be ready – you’ll need to tap the key that it states is used to choose the boot device. It’s sometimes F12 but changes from PC to PC. Select CD/DVD-ROM from the menu. Your PC will now boot up the LiveCD version of your chosen Linux Distro. We’re making progress!

Step 4

OK, once you’re into the desktop, there should be “install now” or similar sitting on the desktop, or in a menu somewhere obvious. You should be given an installation application, similar to the one Fedora produce:

installing

Please, please do make sure that you’re careful here, as you will, at some point be asked which hard drive you want to install to. Disclaimer: You have been warned! Take a mental note of the capacity of your USB stick, and the name of it too. The intention is to install to the ext3 partition you set up earlier. Fill in all the details, then you will be prompted to restart your PC. when it turns off, Please tap the button again to choose the boot device.

Step 5

With any luck, your USB memory stick device will be listed, either on its own, or in the HDD sub menu. Select it, and fingers crossed, you will now be booting the Linux distro of your choice from the USB stick. We’re almost done !

in-fedora

Step 6

My final advise is to update your software packages after the first boot, it will contains the latest and greatest iterations of open source software.

updates

………………….

I hope that this helps you, even if it answers your question of whether or not it can be done, or maybe one or two important tips along the way?

Any comments, questions or feedback, post below !

Comments

  1. Hector Said,

    Hi!

    I’ve been trying to do these but when I tried at Ubuntu it made my computer unable to boot without the USB stuck to it because it installed grub into the pc’s MBR. How can I avoid these? And by the way, is it possible to access the NTFS partition from the Linux distro? I really want the whole USB space.

  2. admin Said,

    Hi Hector,
    It’s unfortunate that the install affected your PC’s hard drive – it seems you have to be extra careful using the GUI installer to deselect all hard drives, leaving only your (unmounted) USB stick selected. Anyway, so the grub has been installed to your PC’s mbr.. Going forward I’m happy to help if I can, but need to clarify one or two things. If you boot from your hard drive without the USB stick inserted, does it pop up with the grub command line interface? I’m guessing so, but may be wrong. If so, just a few commands using the grub command line will fix your grub config, and allow you to boot. Just a few things I need to know first of all… how many hard drives do you have? And on these, how many operating systems do you have? and within each hard drive, how many partitions? The reason for this is because the last thing we want to do is install grub onto, lets say, a Windows partition – it will break that too. But don’t worry, I’ve recovered grub in the past so let me know your setup and we’ll take it from there. Next, yes – you can access ntfs partitions by default now in recent distro releases – which is good news! The benifit of having the ntfs partition is so that it can carry your files to a Windows system to read/write data to your USB stick. If you’re never going to use that partition though, then I suggest ext3 across the whole USB stick – be good to your Linux install with all the space you can give it. If you are too tight with the OS disk space, this will cause issues with, for example, temporary files. For example if you’re doing a distro upgrade (to Jaunty when it is released), it will need to store the packages first of all (in /tmp I think), then install. So be as generous as you can.

    Thanks.

  3. Héctor Said,

    Don’t worry about the grub, I am not that rookie about installing linux in computers I’ve been using ubuntu constantly for the past 2 years, however I am kinda new to install into USBs. My computer, where I am doing the process, has one single hard drive which is divided into vista partition for the system, main partition for the files and some unallocated space I was planning for Ubuntu or my long trying of not so friendly slackware. But since I only used this computer for very few things and my laptop for everything I left it that way. Now that my laptop is dead and my final exams and projects at the turn of the corner I need to manage and take my files and code with me. That is why I’ve been trying to virtualize xp into a usb (since I need visual studio), but being unable/insecure/unusable as it seems to be I am trying to carry ubuntu (or any other disto I can) into the usb and virtualizing xp just for visual studio. I will try now your instructions as it says and will unplug my HD to make sure I don’t lost the info for my homeworks and projects. Will keep you posted.

    Best regards.

Add A Comment

By Rob