Transfering a LiveCD image to a Flash drive

The LiveCD toolset includes a utility to transfer a LiveCD image to a Flash drive. You will need a Flash drive with a capacity larger or equal to the size of your LiveCD image. The supported filesystem of the Flash drive are vfat (fat16, fat32) and ext3.

Connect your Flash drive

Connect your Flash drive to your computer and wait until it is automatically mounted. Then, check which mount point was given to the Flash drive:

# LANG=C df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda7              25G  8.5G   15G  37% /
/dev/sda1              99M   18M   76M  20% /boot
tmpfs                1013M     0 1013M   0% /dev/shm
/dev/sdb1             982M  8.0K  982M   1% /media/usbdisk

In this example, the mount point for the Flash drive is /dev/sdb1.

Create a LiveUSB media

# livecd-iso-to-disk CentOS-5.4-x86_64-LiveCD.iso /dev/sdb1
Verifying image...
/tmp/CentOS-5.4-x86_64-LiveCD.iso:   ad63c0a54086eb35e892d6e1292085e3
Fragment sums: 9e363badf4e9359c76ce8e324bdbd82847bed2dcc8e7e22ecbb2ddda2621
Fragment count: 20
Percent complete: 100.0%   Fragment[20/20] -> OK
100.0
The supported flag value is 0
The media check is complete, the result is: PASS.

It is OK to install from this media.
Already set up as live image.  Deleting old in fifteen seconds...
Copying live image to USB stick
Updating boot config file
Installing boot loader
USB stick set up as live image!

Create a LiveUSB media with a persistent overlay

With livecd-tools 014-7 and later, it is possible to create a LiveUSB media featuring a persistent overlay. An overlay of a fixed size is appended to the standard filesystem. This overlay is a dynamically growing set of blocks that have been modified on the original LiveCD root filesystem. It is used to store data and configuration changes. Technically, the overlay is a loopback block device, used as the copy-on-write space for a devicemapper snapshot of the rootfs.

# livecd-iso-to-disk --overlay-size-mb 200 CentOS-5.4-x86_64-LiveCD.iso /dev/sdb1
Verifying image...
/tmp/CentOS-5.4-x86_64-LiveCD.iso:   ad63c0a54086eb35e892d6e1292085e3
Fragment sums: 9e363badf4e9359c76ce8e324bdbd82847bed2dcc8e7e22ecbb2ddda2621
Fragment count: 20
Percent complete: 100.0%   Fragment[20/20] -> OK
100.0
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
Initializing persistent overlay file
200+0 enregistrements lus
200+0 enregistrements écrits
209715200 octets (210 MB) copiés, 12,5925 seconde, 16,7 MB/s
Installing boot loader
USB stick set up as live image!

The size of the overlay should be no more than 2048MB on a VFAT Flash drive. If you use an ext3 Flash drive, the size of the overlay should be no more than the size of the root filesystem of the LiveCD. This value is defined on the "part / <size in MB>" line of the LiveCD kickstart file. The official CentOS 5 LiveCD has a 4096MB root filesystem.

Using a smaller overlay than the root filesystem can produce errors as the space available on the overlay is filled up. In this case, the LiveCD root filesystem will act as if there still was space available on the overlay while in fact it is fully allocated. However, there are many advantages at using a smaller overlay than the root filesystem on smaller Flash drive (4GB and less) even if it can be filled up eventually. To erase the content of the overlay and return to the original state of the LiveCD, add the reset_overlay kernel parameter at boot time. This will effectively reset the overlay.

Troubleshooting

Error: partition isn't marked bootable!

If you encouter the following message, you will need to update the Flash drive partition table.

# livecd-iso-to-disk CentOS-5.4-x86_64-LiveCD.iso /dev/sdb1
[...]
Partition isn't marked bootable!
You can mark the partition as bootable with 
    # /sbin/parted /dev/sdb
    (parted) toggle N boot
    (parted) quit
Cleaning up to exit...

To update the partition table follow these instructions:

# LANG=C parted /dev/sdb
GNU Parted 1.8.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            

Model: Kingston DataTraveler II (scsi)
Disk /dev/sdb: 1031MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      16.4kB  1031MB  1031MB  primary  fat32 

(parted) toogle 1 boot                                                    
(parted) print                                                            

Model: Kingston DataTraveler II (scsi)
Disk /dev/sdb: 1031MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      16.4kB  1031MB  1031MB  primary  fat32        boot
(parted) quit

Error: Need to have a filesystem label or UUID for your USB device

If you get this error, try setting the label for your usb flash device as follows:

# /sbin/dosfslabel /dev/sdb1 usbdisk

If the error persists upon re-running the script, verify that the label was set

# /sbin/dosfslabel /dev/sdb1

The above should echo 'usbdisk'. If it does, try using the commands that the livecd script uses to get the label:

# /lib/udev/vol_id -l /dev/sdb1
# /lib/udev/vol_id -u /dev/sdb1

If neither of those return 'usbdisk', you'll need to edit the livecd-iso-to-disk script to use dosfslabel instead - here's the diff:

# diff livecd-iso-to-disk livecd-iso-to-disk.bak
114,116c114
< ###  USBLABEL=$(/lib/udev/vol_id -u $dev)
<      USBLABEL=$(/sbin/dosfslabel $dev)
<     
---
120,121c118
< ###   USBLABEL=$(/lib/udev/vol_id -l $dev)
<       USBLABEL=$(/sbin/dosfslabel $dev)
---

Error: vesamenu.c32: not a COM32R image

Such an error occurs when there is a version mismatch between the syslinux program provided on the LiveCD iso image and the syslinux program installed on the host used to create the LiveUSB media. Namely, you probably have syslinux 4.x on the host used to create the LiveUSB media while syslinux 3.x is installed on the LiveCD iso image.

To solve the issue, downgrade the syslinux program on your host to version 3.x and recreate the LiveUSB media.

Other problems

For further troubleshooting, visit this page from the Fedora LiveCD project website.