Create bootable USB drive with Fedora 10 live

by jagbir on January 13, 2009

How about having a linux bootable USB stick? You can insert that in to any PC, do the do without affecting settings of that PC at all. This is even more helpful for linux admins who find it hard to work on friend’s Windows PC instead of taking delicious dinner, after receiving an unrgent call from NOC Deptt.

Here are quick steps on CentOS 5.2 box (should be identical on any RH based distro):

1. Check whether required tools are already installed or not:

# rpm -q livecd
<no output>

2. Install tools:

# yum install livecd-tools

3. Insert your USB stick in one of USB port, it should get automatically detected and mounted. Make sure your stick has atleast 1 GB free space. Jump to step #7 as it’s absolutely not necessary to format it, but if there’s no worthy data in and you are willing to clean it completely before moving forward, here is the way to proceed after unmounting it:

# fdisk -l /dev/sda
Disk /dev/sda: 4043 MB, 4043309056 bytes
125 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 7750 * 512 = 3968000 bytes

Device Boot      Start         End      Blocks   Id  System

4. Proceed to format:

# fdisk /dev/sda
Command (m for help): d
No partition is defined yet!
Command (m for help): n
Command action
 e   extended
 p   primary partition (1-4)
Partition number (1-4): 1
First cylinder (1-1018, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1018, default 1018):
Using default value 1018
Command (m for help): a
Partition number (1-4): 1
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 6
Changed system type of partition 1 to 6 (FAT16)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
Syncing disks.

## here, after initiating fdisk with USB device controller ie /dev/sda (it may be different in your machine, Please make sure you choose correct). We tried deleting (d) any existing partitions, then create new one (n) of type primary (p) with all avaialbe size. Then make this partition active (a) and assign (t) filesystem FAT 16 (6) to it. Save these changes or write these changes to device by pressing w.

5. Issue parprobe to detect new changes and check:

# partprobe
# fdisk -l /dev/sda
Disk /dev/sda: 4043 MB, 4043309056 bytes
125 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 7750 * 512 = 3968000 bytes
 Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1018     3944719    6  FAT16

6. Format USB stick partition (sda1) with FAT file system and mount it:

# mkdosfs -n usbdisk /dev/sda1
mkdosfs 2.11 (12 Mar 2005)
# mount /dev/sda1 /mnt/cam
# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda2              43G   17G   24G  42% /
/dev/hda5              51G   20G   29G  41% /var
tmpfs                 248M     0  248M   0% /dev/shm
/dev/sda1             3.8G  4.0K  3.8G   1% /mnt/cam

7. USB stick is ready for use, you should have ISO image of Fedora 10 in your machine to proceed. If you didnt downloaded yet, get it from here. I’m a kde fan, if you too, grab it from here.

8. Start the actual process of creating bootable and transferring files now. The command syntax is: livecd-iso-to-disk <ISO File path> <USB Device>:

# livecd-iso-to-disk F10-i686-Live.iso /dev/sda1
Verifying image...
F10-i686-Live.iso:   f21debace1339dbdefff323064d40164
Fragment sums: c22bcc22b29728f2a7136396121621caf6c18169f3326e5c7e66153cd57e
Fragment count: 20
Percent complete: 100.0%   Fragment[20/20] -> OK
The supported flag value is 0
The media check is complete, the result is: PASS.
It is OK to install from this media.
Copying live image to USB stick
Updating boot config file
Installing boot loader
USB stick set up as live image!

9. All Done! grab any PC available sideby and restart it (after saving fellows work :). Go to BIOS menu, change boot option from HDD/CD to USB Drive, insert USB stick in one of avaiable USB ports. Start the PC and enjoy!!

  • random geek

    I appreciate the write up. One small typo, step 2., you have -tools too many times. It’s just yum install livecd-tools.

    I’m sure most ppl will figure that out but just thought I’d point it out.

  • jagbir

    fixed. thankx for pointing out.

  • Mohammad Shabaz

    Any way I can install it on my USB from windows…?

  • Francine Alexakis

    Thanks for the great post! seems we share the same taste for games :p

  • Rachele Tony

    We are a group of volunteers and opening a new scheme in our community. Your website offered us with valuable info to work on. You have done an impressive job and our whole community will be thankful to you.

  • Pingback: Samsungs

  • Pingback: linux articles

  • Pingback: open source

Previous post:

Next post: