2008-04-26 09:16:25

Create a bootable Fedora Live image on a USB stick

Every once in a while, I need to haul out a rescue disk for RedHat to fix an issue (usually something like trying to access failed disk systems). Inevitably, I can't find my rescue disk when I actually need it, so I end up having to wait for a new download to finish.

One of the nice features in the recent versions of Fedora is the inclusion of a small script called livecd-iso-to-disk. Just like it says, it creates a Live image on a disk (a USB stick/key/drive/whatever is a removable disk). Joy! Unlike most other image to disk procedures, this is non-destructive to pre-existing data on the disk. In other words, you don't have to dedicate a USB key just for a Live image.

# yum install livecd-tools -y
livna 100% |=========================| 2.1 kB 00:00
fedora 100% |=========================| 2.1 kB 00:00
updates 100% |=========================| 2.3 kB 00:00
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package livecd-tools.i386 0:013-1.fc8 set to be updated
--> Processing Dependency: syslinux for package: livecd-tools
--> Processing Dependency: isomd5sum for package: livecd-tools
--> Running transaction check
---> Package isomd5sum.i386 0:11.3.0.50-2 set to be updated
---> Package syslinux.i386 0:3.36-7.fc8 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================
Package Arch Version Repository Size
=================================================================
Installing:
livecd-tools i386 013-1.fc8 fedora 48 k
Installing for dependencies:
isomd5sum i386 11.3.0.50-2 fedora 149 k
syslinux i386 3.36-7.fc8 fedora 678 k

Transaction Summary
=================================================================
Install 3 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Downloading Packages:
(1/3): livecd-tools-013-1 100% |=========================| 48 kB 00:00
(2/3): syslinux-3.36-7.fc 100% |=========================| 678 kB 00:01
(3/3): isomd5sum-11.3.0.5 100% |=========================| 149 kB 00:01
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: isomd5sum ######################### [1/3]
Installing: syslinux ######################### [2/3]
Installing: livecd-tools ######################### [3/3]

Installed: livecd-tools.i386 0:013-1.fc8
Dependency Installed: isomd5sum.i386 0:11.3.0.50-2 syslinux.i386 0:3.36-7.fc8
Complete!

Next, check to make sure that the USB stick is bootable.

# parted /dev/sdb print
Model: Imation Flash Drive (scsi)
Disk /dev/sdb: 1062MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 1062MB 1062MB primary fat16

Information: Don't forget to update /etc/fstab, if necessary.

Okay, so our USB stick isn't bootable; easy enough to fix!

# parted /dev/sdb
GNU Parted 1.8.6
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Imation Flash Drive (scsi)
Disk /dev/sdb: 1062MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 1062MB 1062MB primary fat16

(parted) toggle 1 boot
(parted) print
Model: Imation Flash Drive (scsi)
Disk /dev/sdb: 1062MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 1062MB 1062MB primary fat16 boot

(parted) quit
Information: Don't forget to update /etc/fstab, if necessary.

Now we're ready to actually copy the image to the disk.

# livecd-iso-to-disk Fedora-8-Live-i686.iso /dev/sdb1
Copying live image to USB stick
Updating boot config file
Installing boot loader
USB stick set up as live image!

Now you have a bootable drive, without destroying the other data on the USB device. Yay!

Tags:   linux     |    Perm Link:   Create a bootable Fedora Live image on a USB stick



James Conner