How to create and use Live USB
This page explains how to create and use Live USB media. A Live USB system stored on flash memory, sometimes called a stick, lets you boot any USB-bootable computer into a Fedora operating system environment without writing to that computer's hard disk. The Live USB stick can feature an area to store changes to the system, called a persistent overlay. It can also have a separate area to store user account information and data such as documents and downloaded files, with optional encryption for security and peace of mind. Finally, with a non-destructive installation, pre-existing files and excess storage space on the stick are accessible from the system. Essentially, you can carry your computer with you in your pocket, booting it on nearly any system you find yourself using.
- A working computer running Fedora or Windows. If you are using other Linux distributions, consider using dd or UNetbootin. UNetbootin is also available for Mac OS X and Windows, and is in the Fedora repository as well.
- A USB flash drive, also known as a USB stick, thumb drive, pen drive, or jump drive, with 1 GB or more of storage space, on a vfat file system (standard for almost all off-the-shelf USB media)
Ability to boot from USB media
Though most modern ones can, not all computers can boot from USB media, due to different BIOS settings and system capabilities. If your computer cannot do so, this procedure will not be useful. If you are not sure and don't mind downloading and installing an image on your USB drive (possibly wiping it of data), the only risk is wasting some time.
If your USB stick is not in working order, this procedure may fail. Watch for error messages during the process.
Some flash drives may not be bootable by default, even if your hardware is capable of doing so. You may need to mark the partition bootable or you may just need to reformat the flash drive. See Errors and Solutions below for more information.
Check the size of your USB stick
Many USB sticks indicate the size on the packaging or the outside of the stick.
If you don't know the size of the stick, or want to check it for data, you should be able to auto-mount the USB stick by inserting it into a USB port. You can check the contents and size using the graphical file manager. In Linux, you can also use the command line:
$ 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
USB drives are usually mounted in /media. In this case, the device is /dev/sdb1, has a 3.9GB capacity and is almost empty.
Take note of "/dev/sdb1" or equivalent; you will be specifying the device name if you use the command line method.
How to Partition
If the drive has not been partitioned properly (or if you are unsure), use
fdisk to repartition it.
It is also possible to do a non-destructive installation of a LiveUSB image, if you have sufficient empty space. See How to install non-destructively below.
fdisk command must be run as root. Include only the drive name in the command, not the partition number. Be sure to select the correct disk, or you may erase important data! Check the output of "df -h" if you are unsure. For example, if your partition will be /dev/sdb1, do:
$ /sbin/fdisk /dev/sdb
If you don't have fdisk installed, run
yum install util-linux-ng as root.
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.
How to Format
If your USB media has sufficient free space on a vfat file system already, you do not need to perform this step.
To finish, the partition must be formatted with an actual file system using
mkdosfs as the root user. Unmount the device before using
mkdosfs. In the below example, /dev/USBPARTITIONNAME might be, for example, /dev/sdb1. Be sure to select the correct partition; formatting destroys all data on it!
$ umount /dev/USBPARTITIONNAME $ /sbin/mkdosfs -F 32 -n usbdisk /dev/USBPARTITIONNAME
If you don't have mkdosfs installed, run "yum install dosfstools" as root.
How to install non-destructively
Skip the repartitioning and formatting step above, and simply continue with the below steps. Please keep in mind you should have at least 1GB free. It is highly recommended to make a backup copy of the data on the USB drive before proceeding in case something goes wrong.
From a Downloaded Image
Download an ISO
(If you are using liveusb-creator - the "Graphical" method below, with a "supported" Fedora release, you can skip this step. The program will download the ISO for you.)
You can use BitTorrent or your web browser to download a bootable image, or ISO, which you will install on your USB drive.
- Supported releases
- Pre-releases (Alpha and Beta; redirects to previous supported release during pre-Alpha phase)
- Rawhide daily build
You are looking for a file with "Live" in the name, usually of the form "F<version>-<architecture>-Live.iso". For example, "F12-i686-Live.iso" is the Fedora 12 release for 32-bit Pentium Pro and compatible CPUs. "F13-Alpha-x86_64-Live.iso" is the alpha pre-release version of Fedora 13 for 64-bit Intel-compatible CPUs. Be sure to choose the correct file for your architecture. 32-bit releases will generally run on 64-bit hardware, but will not be optimized.
These instructions will also work for Custom Spins of Fedora Live ISO images, including those you make yourself with Revisor (a graphical tool), or LiveCD Creator (command-line tool used by Revisor). (Pungi is a command-line tool you can use to create installable ISOs, but not Live ISOs.)
If you use a LiveUSB with data persistence, you can use the "yum update" method described below to get the latest daily Rawhide RPMs (mostly for testers and not everyday use) except for the kernel. See Releases/Rawhide for more information about daily builds.
Live ISOs are not made daily for Branched, Alpha, Beta, and Final phases, only at the Alpha, Beta, and Final milestones.
Graphical Method - Windows or Fedora
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 Fedora, you can use Add/Remove Programs and search for liveusb-creator, or use the command line:
$ su -c "yum install liveusb-creator"
To start, run
liveusb-creator on the command line, or on the GNOME menu, go to "Applications -> System Tools -> liveusb-creator".
If you are using an older version of Fedora (9 or 10), you may need to work around bug 494000.
Command Line Method - Linux only
In the following examples, replace "/path/to/ISO" with e.g. F16-Live-i686.iso or the full path to the ISO you downloaded, e.g. /tmp/F16-Live-i686.iso.
Replace /dev/USBPARTITIONNAME with the appropriate partition name. For example, /dev/sdb1 in the example above ("Check the size of your USB drive"). Be careful to specify the correct device, or you may lose important data!
The livecd-iso-to-disk method also works with DVD install iso images, even though these are not Live images.
Using dd for a direct copy
Fedora 12 and above, you can simply use dd although the specialized tools have additional features like non destructive writing and data persistence. Fedora 12 to Fedora 15 this method will only work for liveCD iso's and NOT install media. With Fedora 16, install media will work fine as well.
$ sudo dd if=F16-Live-i686.iso of=/dev/sdX bs=8M
Note that you want the device name (e.g. /dev/sdx) not the partition name (e.g. /dev/sdx1).
This method also works with netinst.iso and boot.iso images. In Fedora 13, ":/images/install.img" has to be appended to boot parameter stage2=hd:label="Fedora" (you can do it after hitting Tab in boot selection screen) to prevent asking for install.img location in loader text UI. This should be fixed with bug 528809
Make sure the livecd-tools RPM is installed.
$ rpm -q livecd-tools
You will see the name of the RPM and a version number if it is installed, and no output if it is not installed.
If "livecd-tools" is not installed, install it using yum.
$ su -c "yum install livecd-tools"
Run livecd-iso-to-disk script
Script usage is available in the first pages of the livecd-iso-to-disk script.
Make sure that the USB drive is not mounted before executing the following, and give the root password when prompted.
$ su -c "livecd-iso-to-disk /path/to/ISO /dev/USBPARTITIONNAME" Password: Copying live image to USB stick Updating boot config file Installing boot loader USB stick set up as live image!
In case it is not possible to boot from a disk created with the method shown above, you can also tell livecd to format the medium itself. Note that this method causes livecd to format the disk and thus erase all the data on it:
$ su -c "livecd-iso-to-disk --format --reset-mbr /path/to/ISO /dev/USBPARTITIONNAME"
Data persistence means that your files and settings will remain even after you reboot your live system. You can perform updates just like a regular installation to your hard disk except for kernel updates which are not supported. The primary use of this feature is booting a USB stick with your live image as well as the persistent changes.
Use liveusb-creator, a graphical utility to do this easily. Liveusb-creator is available in the Fedora repository and for Windows users as well.
If you prefer the command line, you can run the following command:
$ sudo livecd-iso-to-disk --overlay-size-mb 512 /path/to/ISO /dev/USBPARTITIONNAME
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 for VFAT, but for ext filesystems it is only limited by the available space. 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.
The persistent overlay status may be queried by issuing this command on the live system:
dmsetup status live-rw
The returned value may look like this:
live-rw: 0 8388608 snapshot 42296/204800 176
where the fraction after 'snapshot' for the logical volume is that of 512-byte sectors consumed in the overlay.
From a running Live CD/DVD/USB
If you are already running a live CD or DVD and want to convert that into a bootable USB stick, run the following command as a root user:
# livecd-iso-to-disk /dev/sr0 /dev/USBPARTITIONNAME
From a running Live USB, use /dev/live as the source:
# livecd-iso-to-disk /dev/live /dev/USBPARTITIONNAME
How to Boot a Live USB Drive
- Power off the computer.
- Plug the USB drive into a USB port.
- Remove all other portable media, such as CD, DVD, or floppy disks.
- Power on the computer.
- If the computer is configured to automatically boot off of the USB drive, you will see a screen that says "Automatic boot in 10 seconds..." with a countdown.
- If the computer starts to boot off the hard drive, you'll need to manually configure it to boot off the USB drive.
- Wait for a safe point to reboot safely.
- As the machine starts to reboot, watch carefully for instructions on which key to press (usually a function key or Escape) to enter the boot device selection menu, or "BIOS setup". Press and hold that key. If you miss the window of opportunity (often only a few seconds) then reboot and try again.
- Use the BIOS setup menu to put your USB drive first in the boot sequence. It might be listed as a hard drive rather than a removable drive. Each hardware manufacturer has a slightly different method for doing so. Use caution! Your computer could become unbootable or lose functionality if you change any other settings. Though these settings can be reverted, you'll need to remember what you changed in order to do so.
- Save the changes, exit, and the computer should boot the Live USB drive.
How to Make a bootable USB Drive to Install Fedora instead of using a physical DVD
Why would I want to make a USB device installer from the DVD instead of the LiveCD?
If you are installing to a netbook, or otherwise do not have an optical drive (or burner, or media), and you want the extra flexibility of using the regular DVD installer instead of the Live image, then this method will give a useful install medium. You are then free to customize package selection, choose which filesystem you prefer for your rootfs (ext3 OR ext4, btrfs, etc), and rescue mode is available.
Preparing the USB stick
The easiest setup method is to install Fedora's own livecd-iso-to-disk script from livecd-tools. Note that the liveusb-creator GUI, however, does not support putting the DVD installer on USB. (Unetbootin has worked in the past as well, but does not currently work for Fedora 14 and 15.)
The manual setup method follows:
First, download the DVD iso file of your choice from a . This method also works for the boot and netinstall iso's.
Then, from your running Fedora system (including a Fedora livecd) make sure you have the livecd-tools package installed by doing:
yum install livecd-tools
Use the "mount" command to find the USB stick (e.g., /dev/sdb1) or look at /var/log/messages or df -h to find where the stick was mounted.
Next unmount the USB stick either from the desktop icon or using the umount command - but keep a note of where the USB stick is attached to the filesystem, e.g., /dev/sdb
Now as root run:
# livecd-iso-to-disk --format --reset-mbr --msdos path-to/Fedora-*.iso /dev/sdb
You can also use direct dd copy
dd if=/path/to/iso of=/dev/sdX #where sdX is the point of attachment of the device on the system as observed above </pre == Errors and Solutions == === liveusb-creator problems === * Try the [https://fedorahosted.org/liveusb-creator/wiki/FAQ liveusb-creator FAQ]. * Bugs are tracked in [https://fedorahosted.org/liveusb-creator/ Trac] - see e.g. [https://fedorahosted.org/liveusb-creator/report/1 existing tickets]. Please [https://fedorahosted.org/liveusb-creator/newticket open a new ticket] if you encounter any problems that have not already been reported. * The [https://fedorahosted.org/mailman/listinfo/liveusb-creator liveusb-creator mailing list] has [https://fedorahosted.org/pipermail/liveusb-creator/ archives] which may also be useful. === Partition isn't marked bootable! === If you get the following message, you need to mark the partition bootable. <pre> $ 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.
Partitions 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 your test boot reports a corrupted boot sector, or 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/share/syslinux/mbr.bin > /dev/sdb
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 .
Ubuntu and derivative Linux distributions have a usb-creator program similar to Live USB Creator. This does not work with Fedora .iso images, it silently rejects them. (usb-creator requires the .iso has a Debian layout, with a /.disk/info file and a casper directory.)
The livecd-iso-to-disk script isn't meant to be run from a non-Fedora system. Testers have reported that even though it runs in an Ubuntu 10.10 terminal and may complete successfully, the resulting USB flash drive does not boot (RHBZ #699554).
Expert users may be able to use dd to write the Fedora .iso to the USB flash drive (thereby overwriting its partition information and all files on it). Another workaround is to burn the Fedora .iso to a CD-R, boot from this, and then run Live USB Creator or livecd-iso-to-disk from the Fedora environment.
Testing Live Image on USB
You can test your Live Image on USB using QEMU as shown in the screenshot below.
For example, if your USB flash drive is on /dev/sdb1, you could type following command:
$ umount /dev/sdb1 $ qemu -hda /dev/sdb -m 256 -vga std
Mounting a Live USB filesystem
You can use the liveimage-mount script in the livecd-tools package to mount an attached Live USB device or other LiveOS image, such as a Live.iso or Live CD. This is convenient when you want to copy in or out some file from the LiveOS filesystem on a Live USB, or just examine the files in a Live.iso or Live CD.