Ping Services

Friday, January 21, 2011

Write any Linux Distribution to a live USB on Linux and Windows

Sometimes it's just more practical to install a Linux distribution to a USB rather than a CD because:
  1. USB drives can be used over and over again while only rewritable CDs can be used again and again.
  2. USB drives normally have more storage and you don't have space constraints that will force you to use a DVD.
  3. Some laptops (especially netbooks)  do not have a CD drive at all.
It is quite easy for you to do this on any Linux distro or even on Windows.


Linux
Unetbootin is a handy program that can write any Linux Distribution to a USB. I've used this program multiple times in the past and it has always worked. It is available for download from the project website (link provided below) or it might be present in your package manager.

After starting Unetbootin, you will see this. You have the option of choosing a distribution after which Unetbootin will download and write the image to the USB. You can also choose the .iso file if you have already downloaded the Linux Distro that you would like to install.


Unetbootin supports a very large number of Linux Distributions. However, if your distro of choice isn't listed here, it would be worthwhile to try and install using the .iso file even though it isn't listed.


When you're ready, press OK, wait for a couple of minutes and Presto! It's ready.

I've noticed that it takes a long time to get past the 5% mark but that is mainly because it would be writing a large file to your USB. So be patient and don't quit the program thinking that the process is frozen.

Windows
Unetbootin is also available for Windows (link provided below) but there is an alternative that I think is just as good.


The universal USB installer is a tool available on Windows that I have found extremely reliable (link provided below). It has a similar interface works in a similar way. In case you have a problem with Unetbootin, it is a good idea to try this program as well.



OpenSUSE, a special case
While researching for this article, I found that several people were not able to write OpenSUSE images to a USB using Unetbootin. So here are some instructions, specifically for OpenSUSE.

Windows
The SUSE Studio Imagewriter can be used on Windows. It is available for download (link provided below) and it is very simple to use. After running the .exe file, a window comes up. You only need to select the OpenSUSE iso file and it will be written to your USB drive.


Linux
Step 1
Mount your USB drive

Step 2
Install ddrescue. This should be available in your repositories.

Step 3
Run the following command in the terminal to check how your USB drive is recognized by your system:
ls -l /dev/disk/by-id/*usb*
Now, you should get an output that shows you how your USB drive is recognized.


The relevant drive was the SanDisk_Cruzer as the other one showing a music device. We will need the sdX (The X value depends on your system) and the sdX1 values for future use. In my case, these values are sdc and sdc1

Step 4
Run umount for your sdX1 drive


Step 5
Login as root in order to run the next command or just add sudo in front of the command if you are on Ubuntu or an Ubuntu-based distro.

Syntax: dd-rescue /path/to/folder/filename /dev/sdX


And it should be done!

And so you would be able to test and install various Linux Distributions from the comfort of your USB drive without wasting so many CDs. I hope you found this article useful.

Links
Universal USB installer
Unetbootin
SUSE Studio Imagewriter

No comments:

Post a Comment