Saturday, March 6, 2010

Install Linux in USB pen drive

Now a days every one have a USB flash drive with them.Now what if a cool small Linux OS is installed on it and booting from the flash drive with the expense of merely a 200 MB space. I think its quiet cool to have a pen drive installed with an operating system. Today I am going to discuss the same thing with you people.

There are a number of Linux distros available for installing in a flash drive. However I think 'Slax' is the coolest one and here I am selecting the same in this post. Slax is actually a customized version of the famous 'Slaxware Linux'. The Slax will give you a full fledged Live OS environment from your pen drive.

Let me give you an intro of the slax distro. As I mentioned earlier, slax is a stripped down version of the Slaxware Linux. It is available in two formats, .iso and .tar. However the contents of both are same. You can convert the iso image to tar and vice verse. Actually the iso is for writing to a compact disk and booting from it. The tar is meant for installing to a flash drive. It can be installed directly to a variety of storage devices like flash key, MP3 player, or even to a hard disk. the slax installer is all set to make the device in which you are installing it bootable and hence it will be like a fully functional operating system. It can be installed on the pen drive using a Windows box of Linux box.

Features of Slax OS.
The most important feature of the Slax operating system is its small size. It will take only 200 MB from your installation drive making it highly suitable for flash drives. Technically speaking Slax implements 7-zip LZMA compression method into into squashfs filesystem. This great combination makes slax one of the best compressed operating systems available. More over you can download a variety of Slax modules (app. packages) for adding components to your OS. These modules are compressed in LZMA format and decompression speed is higher than reading data from the drive.

Portability is the other feature of the Slax OS. It also makes use of the AUFS filesystem for the system data and modules. These read-only part is over layered with a writable filesystem. Thus you can change all parts of the Slax and the changes to the read-only part is transparently copied to the persistent directory on your disk drive or to memory. If Slax is running from a writable media say, flash drive it will save all your changes to it automatically. One more important point is that in Slax the whole root file system is writable other than the persistent 'home' directory in other live distributions.

The Slax OS is quiet feature rich. It equips XWIndow system, KDE Desktop environment, K-office, firefox for internet browsing, instant messaging application, CD/DVD burning applications, multimedia players, audio-video encoding applications and much more via modules. I will describe more about adding more modules below.

Another important feature of the Slax OS is that it comes with 28 different languages.

Just thing how cool is it, you getting all these features from your pen drive with an expense of just 200 MB.


Installing the Slax in USB requires the folowing:
1. A USB flash drive with a minimum of 256 MB space.
2. SLAX-6.x.x.x.tar.
3. Winrar or similar extraction tool (if installing from Windows).
4. Windows or Linux box.

First download the slax installer file from:

You should format your pendrive in fat filesystem for maximum compatibility.
If you are using Windows OS, right click the drive and format with fat file system, quiet straight forward naaa??

Now if you are in Linux find out the device name using:

# fdisk -l

In my case it is "/dev/sdb1". This may not be correct with you. Be very careful, you should not miss this. If you use incorrect filesystem you will lose all your data.

# mkfs.vfat /dev/sdb1

Yea, now your pen drive is ready for a new OS.
Extract the slax-6.x.x.x.tar file to the pen drive. You can use winrar or winzip or any other archiving software for this in Windows.
In Linux you better copy the the slax-6.x.x.x.tar file to the pen drive and issue the following commands.

# mount /dev/sdb1 /media
# cp /path-to-file/slax-6.x.x.x.tar /media

Here the path-to-file is the location of the slax-6.x.x.x.tar.

# tar -xvf slax-6.x.x.x.tar

This will extract the slax-6.x.x.x.tar and create two folders '/boot' and '/slax' in the pen drive. Now you just need to make the pen drive bootable. Navigate to the '/boot' directory. There you will see a number of files including the kernel modules. Now if you are in Windows operating system find and run bootinst.bat script.
You will get the following pop up windows.

Here check if the displayed drive is the pen drive and press with enter key.

NOTE: However any error messages through out stating "Windows - No Disk Exception Processing Message c0000013 Parameters 75b6bf9c 75b6bf9c", just ignore it and click continue!!!

Yea you are done now!!!

If you are in Linux run the script as follows:

# sh ./

You will get the following pop ups

Like I told earlier just make sure that device name specified is your pen drive itself and press enter.


This will install the 'syslinux' bootloader to the pen drive's MBR (Master Boot Record). However syslinux works only on FAT file system. If you are so particular about other filesystems, you can choose the '' instead of the '' (obviously from Linux box only).

Now you are done. Your pen drive is installed with a cute little Linux and it is ready to rumble!!!!!

Booting to your pen drive.
Restart your computer. Go to BIOS and make the first boot device "USB Flash Drive". Most of the modern mother boards support USB booting. You will be booted to the Slax OS with in seconds!!!!!

Here are some of the screen shots of the Slax OS, its looking really cool!!!

OK guys bye for now!!!!! please post your comments and questions if any!!!!!!!!!!!!!!!!!!!!!!!!!!!!


  1. can any one tell me how to install linux on a usb pen drive. i would like to use knoppix , is it possible to create a "live pen drive" like a "live cd" from an existing live cd i have a 2 GB gb Linux Flash Drive

  2. Dear Justin,

    You can use a tool called "Universal USB Installer" for installing youe knoppic iso image to a pendrive. First download the tool from:

    1.Run the tool from a windows machine,
    2.Select the distribution (for you knoppix)
    3. Browse to the ISO file you have (for you knoppix)
    4. Select the pendrive
    5. Allow Persintance to save files
    6. Also allow formatting the pendrive for better results
    7. Click install
    8. Boot from the pendrive

    It is pretty straight forward, I am sure that you will get through it easily.

    Please give me a comment back if you come across any problem and also if you are successful.