From Fedora Project Wiki

Revision as of 21:51, 30 May 2008 by Tchung (talk | contribs)

How to Install Live Image to USB Flash Drive

Using Fedora

  • Host OS: Fedora
  • ISO Image: Fedora-<release>-Live-i686.iso
  • Hardware: USB Flash Drive with 1 GB or bigger (aka USB Storage Stick or USB Thumb Drive)
Please note some flash drive may not be bootable by default. You may need to mark the partition bootable or you may just need to reformat the flash drive. See section below for more information.
Be warned. This document may or may not work on your flash drive or your computer due to different BIOS settings and capabilities. I've tested several flash drives on several computers and the results were unexpected and surprising. Flash Drive A worked on Computer X but not on Computer Y. Flash Drive B didn't work on Computer X but worked on Computer Y.

Check USB device

[tchung@localhost iso] $ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
143G   14G  122G  10% /
/dev/sda1              99M   12M   82M  13% /boot
tmpfs                1009M     0 1009M   0% /dev/shm
/dev/sdb1             3.9G  4.0K  3.9G   1% /media/usbdisk

Check livecd-tools

$ rpm -q livecd-tools

If 'livecd-tools' is not installed, install it using yum.

$ su -c 'yum install livecd-tools'

Non-Destructive USB Install

Notice in this

File:FedoraLiveCD USBHowTo usb flash drive.png
screenshot

, the original content of the USB drive was not deleted by the script. That's because we use 'non-destructive' process.

In this demo, I used Imation Swivel Pro Flash Drive 1GB which comes with a Imation software as shown in the screenshot. You should be able to pick one up from local Target under $30 in United States.

Run livecd-iso-to-disk script

$ ls
Fedora-<release>-Live-i686.iso
$ livecd-iso-to-disk Fedora-<release>-Live-i686.iso /dev/sdb1
You need to be root to run this script
$ su
Password:
Fedora-<release>-Live-i686.iso
Copying live image to USB stick
Updating boot config file
Installing boot loader
USB stick set up as live image!
#

Data Persistence

Data persistence means that your files and settings will remain peristent even after you reboot your live system. Persistence is supported from Fedora 9 (beta) onwards. The primary usage of this feature is booting a USB stick with your live image as well as the persistent changes. To do this, take the live image and you can run the following command:

livecd-iso-to-disk --overlay-size-mb 512 /path/to/iso /path/tousbstick

where 512 is the desired size (in megabytes) of the overlay. You can find the livecd-iso-to-disk shell script in the LiveOS directory at the top-level of the CD image. Note that you'll need to have space on your USB stick for the live image plus your overlay plus any other data you want on the stick.

Bootable USB from a running Live CD/DVD

If you are already running a live CD or DVD and want to convert that into a bootable USB stick, run the following command:

livecd-iso-to-disk /dev/live /path/tousbstick

Using Windows

Fedora LiveUSB sticks can be created in Windows using the liveusb-creator , using the following steps:

If you encounter any issues using this method, please create a ticket against the liveusb-creator.

Errors and Solutions

Partition isn't marked bootable!

If you get following message, you need to mark the partition bootable.

Partition isn't marked bootable!
You can mark the partition as bootable with
(parted) toggle N boot
(parted) quit
Cleaning up to exit...
#

To mark the partition bootable,

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.
#

Partition need a filesystem label!

If you get following message, you need to label the partition.

Need to have a filesystem label or UUID for your USB device
Label can be set with /sbin/dosfslabel
Cleaning up to exit...

To label the partition.


Partition has different physical/logical endings!

If you get following message, you may need to reformat the flash drive.


Disk /dev/sdb: 2029 MB, 2029518848 bytes
129 heads, 32 sectors/track, 960 cylinders
Units = cylinders of 4128 * 512 = 2113536 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         961     1981936    6  FAT16
Partition 1 has different physical/logical endings:
phys=(967, 128, 32) logical=(960, 31, 32)

MBR appears to be blank!

If you get following message, you need to install MBR.

MBR appears to be blank.
You can add an MBR to this device with
Cleaning up to exit...

To install MBR,


How to reformat flash drive

Use 'fdisk to reformat flash drive as following:


Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 1
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
Selected partition 1
Hex code (type L to list codes): 6
Changed system type of partition 1 to 6 (FAT16)

Command (m for help): a
Partition number (1-4): 1

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
information.
Syncing disks.

mkdosfs 2.11 (12 Mar 2005)
#

SYSLINUX Boot Error!

If you were using the script on previous Red Hat or Fedora Release and getting following error message,

SYSLINUX 3.xx ... EBIOS Load error - Boot error

You may need to upgrade your syslinux to 3.50 or higher from Peter Anvin's SYSLINUX .

Testing Live Image on USB

You can test your Live Image on USB using QEMU as shown in this File:FedoraLiveCD USBHowTo usb flash with qemu.png screenshot] .

For example, if your USB flash drive is on /dev/sdb1, you could type following command:

# qemu -hda /dev/sdb1 -m 256 -std-vga


References