msgbartop
Illustrates and Examines some of the best tools and ideas in Computer Science
msgbarbottom

16 Oct 09 Booting from a USB device

There are various reasons for which you might want to consider booting from a
usb. The recent trend in using net-books has made this very necessary as most
net books do not contain an in-built CD-ROM. Hence, the only options one
has, is, to either buy an external CD-ROM with an external USB interface and
carry this CD ROM wherever you go or be smart and learn to do everything using
a USB. In fact, the primary motivation for me to learn to boot from
a USB was to install a linux operating system on my friend’s
assus netbook.
Please note that before you start you must first ensure that the computer in question
actually supports booting from a USB and you may have to change Bios settings appropriately.

This post explains how to replicate an iso file of any
Operating system (preferably one of the linux distros) into
a bootable partition of a USB device. I have successfully installed operating systems
on a USB partition using Ubuntu 8.04 as well as Ubuntu 9.04.

If you can install target="_blank">unetbootin then do use it and forget about the
rest of this post as unetbootin is an amazing tool
to get the job done. However, even for unetbootin, you need to first
create a bootable partition on the USB device which I have explained in
my target="_blank">previous post. So, before you proceed to use unetbootin,
I would suggest that you first create a bootable partition on the USB
by referring target="_blank">here.

As for those who do not have Unetbootin or cannot install it, the following steps will
help you to replicate any .iso file into a bootable partition of your USB hard disk:

  1. Prerequisites
    • syslinux tools
        $sudo apt-get install syslinux
      
    • Create a bootable partition on your USB

      Please refer to my target="_blank">previous post where I have used
      gparted to get the job done.
      It is the easiest way and least error-prone.

    • Download this script (which did not work on Ubuntu 9.04):
        wget http://zelut.org/projects/misc/isotostick.sh
      

      Make it executable with the command:

        $chmod u+x isotostick.sh
      
  2. Run the script isotostick.sh downloaded in the previous step.
    It requires two arguments, the .ISO file and the bootable partition
    on the USB device. This step may take some time depending on the speed of the usb and your machine among other things,
    so please be patient and allow it to run in the background.

      $sudo ./isotostick.sh /path/to/your.iso /dev/sdXn
    

    Note that the second argument may vary depending on the location of the bootable partition.
    The command I used is as given below.

      $sudo ./isotostick.sh iso/ubuntu-8.10-desktop-i386.iso /dev/sdb3
    
  3. Make sure its bootable with syslinux:
            $sudo syslinux /dev/sdXn
    

    So, I had to run

            $sudo syslinux /dev/sdb3
    

That’s it !!!

You are now ready to boot the newly installed Operating System from the bios
prompt.