March 16, 2009

Live USB Magic

Now a days almost all the computers have the ability to boot from USB. This ability can be put to use by installing an operating system on a usb stick. This makes it possible to carry your OS with you where ever you go. Live usb is an example of OS on usb stick. All you need to make a live usb is a live image of the OS and a usb disc with sufficient memory. This post explains in a step by step manner the process of creating a live usb.

1)Download the live image from the site

Here's the link for Fedora: Fedora10-KDE-Live

2)Check the size of your usb stick

You can do it by issuing this command:

df -h

3)Creating partition and filesystem on the usb stick

Issue the following command to get into fdisk and follow the steps:

fdisk /dev/USBDEVICE (/dev/sdc in my case)

Command (m for help): d (This deletes the partitions)
Selected partition 1

Command (m for help): n (This creates a new partition)
Command action
e extended
p primary partition (1-4)
Partition number (1-4): 1 (This gives the number of partitions)
First cylinder (1-960, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-960, default 960):
Using default value 960

Command (m for help): t (This sets the file system type)
Selected partition 1
Hex code (type L to list codes): 83 (For Linux flesystem types-
ext3/ext2 etc)
Changed system type of partition 1 to 83 (Linux)

Command (m for help): a (This toggles the bootable flag)
Partition number (1-4): 1 (This is the partition number which is
to made bootable- /dev/sdc1
in my case. So '1')
Command (m for help): w (Writes the changes to the partition table)
The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

4)Formatting the file system

First unmount the usb stick


Then issue the following command to format in EXT3 filesystem.

Caution: THis will erase all files on the disc

mkfs.ext3 -L usbdisk /dev/USBPARTITIONNAME (/dev/sdc1 in my case)

5)Copying the live Fedora image

su -c "livecd-iso-to-disk /path/to/ISO /dev/USBPARTITION" (/dev/sdc1 in
my case)
Copying live image to USB stick
Updating boot config file
Installing boot loader
USB stick set up as live image!

6)Booting from the live usb

Restart the computer and go to BIOS. Enable USB boot and change the priority of usb device to highest. This has to be done with the usb stick inserted. Then save the changes and exit BIOS. The computer will auto restart and voila. The live usb is in action. Behold the live OS (Fedora Live) coming up on your screen.

For troubleshooting refer to this Tutorial

1 comment:

  1. or use fedora liveusb creator

    but that sounds like it'll work too :)