- 1 How to Install Live Image to USB Flash Drive
- 1.1 System Requirements
- 1.2 Bootable USB from a running Live CD/DVD
- 1.3 Graphical Interface - Windows and Linux
- 1.4 Errors and Solutions
- 1.5 Testing Live Image on USB
- 1.6 References
How to Install Live Image to USB Flash Drive
This article is also a good reference:
- 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)
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
$ 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 the screenshot on right, 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
Give the root password when prompted.
ls Fedora-<release>-Live-i686.iso su -c "livecd-iso-to-disk Fedora-<release>-Live-i686.iso /dev/sdb1" Password: Copying live image to USB stick Updating boot config file Installing boot loader USB stick set up as live image!
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. The livecd-iso-to-disk shell script won't accept an overlay size value greater than 2047. 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
Graphical Interface - Windows and Linux
Fedora LiveUSB sticks can be created in Windows and Linux using the liveusb-creator, For Windows using the following steps:
- Download liveusb-creator from http://fedorahosted.org/liveusb-creator
- Double click 'liveusb-creator'
If you are using Linux, You can use Add/Remove Programs and search for liveusb-creator or
yum install liveusb-creator
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 the following message, you need to mark the partition bootable.
# livecd-iso-to-disk Fedora-<release>-Live-i686.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 mark the partition bootable,
# 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. #
Partition need a filesystem label!
If you get the following message, you need to label the partition.
# livecd-iso-to-disk Fedora-<release>-Live-i686.iso /dev/sdb1 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.
# dosfslabel /dev/sdb1 usbdisk
Partition has different physical/logical endings!
If you get the following message, you may need to reformat the flash drive.
# fdisk -l /dev/sdb 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 the following message, you need to install MBR.
# livecd-iso-to-disk Fedora-<release>-Live-i686.iso /dev/sdb1 MBR appears to be blank. You can add an MBR to this device with Cleaning up to exit...
To install MBR,
# cat /usr/lib/syslinux/mbr.bin > /dev/sdb
How to reformat flash drive
fdisk to reformat the flash drive. If the drive is not new, a reformat is recommended. The
fdisk command must be run as root or using the
su -c 'fdisk /dev/sdb'
The following session output from
fdisk shows the responses to give to the prompts. The line starting
Last cylinder ... refers to the size of the flash drive, so may be different than in the example.
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.
To finish, the partition must be initialized with an actual file system using
mkdosfs as the root user. Unmount the device before using
umount /dev/sdb1 su -c 'mkdosfs -n usbdisk /dev/sdb1'
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 the screenshot on right.
For example, if your USB flash drive is on /dev/sdb1, you could type following command:
# qemu -hda /dev/sdb -m 256 -std-vga