How to create and use Live USB

From FedoraProject

(Difference between revisions)
Jump to: navigation, search
(drop the stupid $ thing.)
m (Command line method: Using the livecd-iso-to-disk tool (Fedora only): italics)
(37 intermediate revisions by 8 users not shown)
Line 3: Line 3:
 
[[Category:LiveMedia]]
 
[[Category:LiveMedia]]
 
</noinclude>
 
</noinclude>
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.
+
[[Image:Artwork_DesignService_fedora-iso-usb.png‎|right]]
 +
This page explains '''how to create and use Fedora 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.  
  
 +
With current Fedora releases you can also write the non-live Fedora installation images (the DVD and network installation images) to a USB stick, which many users find more convenient and faster than writing to an actual optical disc.
  
 
{{admon/note | Quick start | The process for most people is simple.  Almost all USB sticks are provided by hardware manufacturers ready to use with this process.  If you have any documents on your USB stick, it's not a bad idea to ''back them up'' before you start.
 
{{admon/note | Quick start | The process for most people is simple.  Almost all USB sticks are provided by hardware manufacturers ready to use with this process.  If you have any documents on your USB stick, it's not a bad idea to ''back them up'' before you start.
Line 14: Line 16:
 
Then reboot your system and use your computer's built-in function to choose the USB boot device -- usually this is a special key you hold down at boot time, such as '''F12'''.  Then enjoy!
 
Then reboot your system and use your computer's built-in function to choose the USB boot device -- usually this is a special key you hold down at boot time, such as '''F12'''.  Then enjoy!
  
If you are into technical details or want more information, please read on.}}
+
If you are into technical details or want more information on alternative tools and advanced usage, please read on.}}
 
+
{{admon/warning | Using UNetbootin | Following each release, Fedora support volunteers receive reports of problems with installation images created by Unetbootin. Using the most recent version of Unetbootin available has been known to improve results. While your results may vary, for best results, use the liveusb-creator.}}
+
 
+
  
 
__TOC__
 
__TOC__
Line 23: Line 22:
 
{{admon/important | Creating Live CD ISO image | A Live USB system is created from the same ISO image file that is used to create Live CD/DVD media.  You can download ISO images for the official Fedora release from [http://fedoraproject.org/get-fedora the Fedora download site].  Consult [[How to create and use a Live CD]] for more information on creating your own customized ISO image file.}}
 
{{admon/important | Creating Live CD ISO image | A Live USB system is created from the same ISO image file that is used to create Live CD/DVD media.  You can download ISO images for the official Fedora release from [http://fedoraproject.org/get-fedora the Fedora download site].  Consult [[How to create and use a Live CD]] for more information on creating your own customized ISO image file.}}
  
== System Requirements ==
+
= System Requirements =
  
* A working computer running Fedora  or Windows. If you are using other Linux distributions, consider using dd or [http://unetbootin.sourceforge.net/ UNetbootin]. UNetbootin is also available for Mac OS X and Windows, and is in the Fedora repository as well.  
+
* A working computer running GNU/Linux, Windows or MacOS.
* A [[wikipedia:USB flash drive|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)
+
* A [[wikipedia:USB flash drive|USB flash drive]], also known as USB stick, thumb drive, pen drive, or jump drive, with 1 GB or more of storage space.
 +
* A Fedora ISO file, which you can download from http://fedoraproject.org/get-fedora.
  
===Ability to boot from 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
+
* 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 its data), the only risk is wasting some time.
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.
+
* 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 [https://fedoraproject.org/wiki/How_to_create_and_use_Live_USB#Errors_and_Solutions Errors and Solutions] below for more information.
+
= GNU/Linux instructions =
  
=== Check the size of your USB stick ===
+
== Identifying your USB disk ==
  
Many USB sticks indicate the size on the packaging or the outside of the stick.
+
The first step is to identify the name of the USB drive partition.
  
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:
+
* Insert the USB stick into a USB port.
 +
 
 +
* Open a terminal and run {{command|dmesg}}.
 +
 
 +
* You will see something like
  
 
<pre>
 
<pre>
$ df -h
+
[32656.573467] sd 8:0:0:0: [sdX] Attached SCSI removable disk
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
+
 
</pre>
 
</pre>
  
USB drives are usually mounted in /media.  In this case, the device is /dev/sdb1, has a 3.9GB capacity and is almost empty.
+
where sdX will be sdb, sdc, sdd, etc. '''Take note of this label''' as it is the name of the disk you will use. We'll call it ''sdX'' from now on.
 
+
Take note of "/dev/sdb1" or equivalent; you will be specifying the device name if you use the command line method.
+
 
+
== How to Partition ==
+
 
+
{{admon/warning | CAUTION | This will erase all data on the USB drive!  Please read the instructions below ''carefully''.}}
+
 
+
If the drive has not been partitioned properly (or if you are unsure), use <code>fdisk</code> to repartition it.
+
  
It is also possible to do a non-destructive installation of a LiveUSB image, if you have sufficient empty space. See [https://fedoraproject.org/wiki/How_to_create_and_use_Live_USB#How_to_install_non-destructively How to install non-destructively] below.
+
== Checking USB disk size ==
  
The <code>fdisk</code> 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:
+
As noted before, the disk must have at least 1 GB of storage space. You can check this by running the {{command|df -h}} command. Look for a line like the following:
  
 
<pre>
 
<pre>
$ /sbin/fdisk /dev/sdb
+
/dev/sdX1            3.9G  4.0K  3.9G  1% /media/usbdisk
 
</pre>
 
</pre>
  
If you don't have fdisk installed, run <code>yum install util-linux-ng</code> as root.  
+
and make sure the first column reads more than 1.0G.
  
The following session output from <code>fdisk</code> shows the responses to give to the prompts.  The line starting <code>Last cylinder ...</code> refers to the size of the flash drive, so may be different than in the example.
+
You can also use a file manager like {{command | nautilus}}, by right clicking and selecting ''Properties'':
  
Command (m for help): '''d'''
+
[[image:Properties_USB_size.png]]
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 ==
+
== Writing the image ==
  
{{admon/warning | CAUTION | This will erase all data on the USB drive!  Please read the instructions below ''carefully''.}}
+
=== Graphical method: using {{command|liveusb-creator}} (Windows/Fedora only) ===
  
If your USB media has sufficient free space on a ''vfat'' file system already, you do not need to perform this step.
+
[[Image:Fedora_Live_USB_creator.png]]
  
To finish, the partition must be formatted with an actual file system using <code>mkdosfs</code> as the root user.  Unmount the device before using <code>mkdosfs</code>. 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!'''''
+
Fedora USB sticks can be created using the [http://fedorahosted.org/liveusb-creator liveusb-creator] utility. Note that this utility is only capable of writing Live images.
  
 +
You can use Add/Remove Programs and search for ''liveusb-creator'', or use the command line:
 
<pre>
 
<pre>
$ umount /dev/USBPARTITIONNAME
+
su -c 'yum install liveusb-creator'
$ /sbin/mkdosfs -F 32 -n usbdisk /dev/USBPARTITIONNAME
+
 
</pre>
 
</pre>
  
If you don't have mkdosfs installed, run "yum install dosfstools" as root.
+
To start, run {{command|liveusb-creator}} on the command line or search liveusb-creator on the GNOME activities overview.
  
== How to install non-destructively ==
+
To use the tool, simply select a Fedora release to download from the drop-down box at top-right (or select an ISO you have already downloaded using the ''Browse'' button at top-left), select the USB stick to which you wish to write the image from the ''Target Device'' drop-down box, and hit the ''Create Live USB'' button.
  
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.
+
=== Another graphical method: using UNetbootin ===
  
== From a Downloaded Image ==
+
{{admon/warning | About UNetbootin | Following each release, Fedora support volunteers receive reports of problems with installation images created by UNetbootin. Using the most recent version of UNetbootin available has been known to improve results.
 +
# There is '''no persistent storage''' for operating or user filesystem changes with this installation method for Fedora&mdash;any file changes on those filesystems will be lost on shutdown. (Files written to the USB device filesytem, mounted at {{Code|/run/initramfs/live}}, are persistent.)
 +
# It is easiest to start with an empty device filesystem&mdash;a device with another Live installation can leave files that interfere with the new installation.
  
=== Download an ISO ===
+
While your results may vary, it is usually the case that the ''liveusb-creator, livecd-iso-to-disk,'' and ''dd'' methods give better results than UNetbootin. If you encounter problems with UNetbootin, please contact the UNetbootin developers, not the Fedora developers.}}
  
(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.)
+
UNetbootin is a graphical, bootable USB image creator. Using it will allow you to preserve any data you have in the USB drive.
  
You can use BitTorrent or your web browser to download a bootable image, or ISO, which you will install on your USB drive.
+
[[Image:Unetbootin_gtk3.png]]
  
Quick links:
+
* Download UNetbootin latest version from http://unetbootin.sourceforge.net/ and install it.
* [http://fedoraproject.org/en/get-fedora Supported releases]
+
* You might have to type the root password when running it.
* [http://fedoraproject.org/get-prerelease Pre-releases] (Alpha and Beta; redirects to previous supported release during pre-Alpha phase)
+
* Click on '''Diskimage''' and search for the ISO file you downloaded.
* [[Releases/Rawhide|Rawhide]] daily build
+
* Select Type: USB drive and choose ''sdX'' drive.
 +
* Press OK.
  
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.
+
{{admon/note | Note | If you do not see ''sdX'' listed, you might have to reformat the drive, '''effectively loosing all your data on the drive''': <pre>su -c "umount /dev/sdX"
 +
su -c "mkfs.vfat -I /dev/sdX"</pre>.}}
  
These instructions will also work for [[Spins Custom|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.)
+
=== Simple command line method: write the image directly ===
  
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) [https://bugzilla.redhat.com/show_bug.cgi?id=446935 except for the kernel].  See [[Releases/Rawhide]] for more information about daily builds.
+
{{admon/warning | CAUTION | This will erase all data on the USB drive!  Please read the instructions below ''carefully'' and make sure you write the right drive label ''(sdX)''.}}
  
Live ISOs are ''not'' made daily for Branched, Alpha, Beta, and Final phases, only at the Alpha, Beta, and Final milestones.
+
To write the ISO file directly to the disk, run:
  
=== Graphical Method - Windows or Fedora ===
+
<pre>
 +
su -c "dd if=/Users/me/Downloads/Fedora-17-x86_64-DVD.iso of=/dev/sdX bs=8M"
 +
</pre>
  
Fedora LiveUSB sticks can be created in Windows and Linux using the [http://fedorahosted.org/liveusb-creator liveusb-creator].
+
Or, if you are running an Ubuntu-based distribution
  
For Windows using the following steps:
+
<pre>
* Download liveusb-creator from http://fedorahosted.org/liveusb-creator
+
sudo dd if=/Users/me/Downloads/Fedora-17-x86_64-DVD.iso of=/dev/sdX bs=8M
* Double click 'liveusb-creator'
+
</pre>
  
 +
Note that the process will take some time and you will not see any information while it is running.
  
If you are using Fedora, you can use Add/Remove Programs and search for ''liveusb-creator'', or use the command line:
+
=== Command line method: Using the ''livecd-iso-to-disk'' tool (Fedora only) ===
  
<pre>
+
The ''livecd-iso-to-disk'' is the most capable, non-destructive, and often most reliable method of writing a Fedora ISO image to a USB stick, but it can be used reliably only from within Fedora. It does not work in Windows and is not supported (and will usually fail) in non-Fedora distributions. Please use the ''liveusb-creator'' tool, ''dd'' (or an equivalent tool), or a third-party tool such as ''UNetbootin'' on other operating systems. It is also not a good idea to try and write a new Fedora release using the version of ''livecd-iso-to-disk'' in a much older Fedora release: It is best to only use a release a maximum of two versions older than the release you are trying to write.
$ su -c "yum install liveusb-creator"
+
</pre>
+
  
 +
Make sure the ''livecd-tools'' RPM is installed with the command
  
To start, run <code>liveusb-creator</code> on the command line, or on the GNOME menu, go to "Applications -> System Tools -> liveusb-creator".
+
: {{Code|rpm -q livecd-tools}}.
  
If you are using an older version of Fedora (9 or 10), you may need to work around [[Common F11 bugs#494000|bug 494000]].
+
You will see the name of the RPM and a version number if it is installed, or no output if it is not installed.
  
=== Command Line Method - Linux only ===
+
If ''livecd-tools'' is not installed, install it using this command, or PackageKit:
  
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.
+
: {{Code|su -c 'yum install livecd-tools'}}
  
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!'''''
+
Detailed usage information is available in the first pages of the [http://git.fedorahosted.org/cgit/livecd/tree/tools/livecd-iso-to-disk.sh#n27 livecd-iso-to-disk script], which you can also see by running this command:
  
The [[livecd-iso-to-disk]] method also works with DVD install iso images, even though these are not Live images.
+
: {{Code|su -c 'livecd-iso-to-disk --help'}}
  
==== Using dd for a direct copy ====
+
Basic examples follow.
  
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.
+
To make an existing USB stick bootable as a Fedora image—without deleting any of the data on it—make sure that the USB drive is not mounted before executing the following, and give the root password when prompted:
  
$ sudo dd if=''F16-Live-i686''.iso of=/dev/sd''X'' bs=8M
+
: {{Code|su -c "livecd-iso-to-disk Fedora-17-x86_64-Live-Desktop.iso /dev/sdX"}}
  
Note that you want the device name (e.g. /dev/sdx) not the partition name (e.g. /dev/sdx1).
+
See [[#Data persistence|Data persistence]] below for how to create Live USB devices with more than temporary storage of user files and settings.
  
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 [https://bugzilla.redhat.com/show_bug.cgi?id=528809 bug 528809]
+
In case it is not possible to boot from a disk created with the method shown above, before re-partitioning and re-formatting, often resetting the master boot record will enable booting:
  
==== Check livecd-tools ====
+
: {{Code|su -c "livecd-iso-to-disk --reset-mbr Fedora-17-x86_64-Live-Desktop.iso /dev/sdX"}}
  
Make sure the livecd-tools RPM is installed.
+
{{admon/warning | CAUTION: | Using the {{Code|--format}} option in the following command will erase all data on the USB drive!  Please read the instructions below ''carefully''.}}
 +
: If necessary, you can have ''livecd-iso-to-disk'' re-partition and re-format the target stick:
  
<pre>
+
: {{Code|su -c "livecd-iso-to-disk --format --msdos --reset-mbr Fedora-17-x86_64-Live-Desktop.iso /dev/sdX"}}
$ rpm -q livecd-tools
+
</pre>
+
  
You will see the name of the RPM and a version number if it is installed, and no output if it is not installed.
+
==== UEFI boot of USB sticks ====
  
If "livecd-tools" is not installed, install it using yum.
+
Whether a Fedora image written to a USB stick will be bootable natively via [[wikipedia:UEFI|UEFI]] is a somewhat complex question which depends on the Fedora release, the type of image (live or non-live), and the method used to write it. The {{Code|--efi}} parameter to the ''livecd-iso-to-disk'' tool attempts to make a stick written with that tool natively UEFI bootable.
<pre>
+
$ su -c "yum install livecd-tools"
+
</pre>
+
  
==== Run [[livecd-iso-to-disk]] script ====
+
As of {{FedoraVersion|long|17}}, all images written using the ''dd'' method should be UEFI-bootable, and all images written with {{Code|livecd-iso-to-disk --format --reset-mbr --efi}} should also be UEFI-bootable. Use of {{Code|--efi}} without {{Code|--format}} and {{Code|--reset-mbr}} can be considered a 'best effort', and may not produce a UEFI-bootable stick.
  
Script usage is available in the first pages of the [http://git.fedorahosted.org/git/?p=hosted/livecd;a=blob;f=tools/livecd-iso-to-disk.sh;hb=HEAD livecd-iso-to-disk script].
+
==== Creating a USB stick from a running live environment ====
  
Make sure that the USB drive is not mounted before executing the following, and give the root password when prompted.
+
If you are already running a live CD, DVD, or USB and want to convert that into a bootable USB stick, run the following command:
  
$ su -c "livecd-iso-to-disk ''/path/to/ISO'' /dev/''USBPARTITIONNAME''"
+
: {{Code|su -c "livecd-iso-to-disk /run/initramfs/livedev /dev/sdX"}}
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''':
+
(For versions before Fedora 17, use {{Code|/dev/live}} instead of {{Code|/run/initramfs/livedev}}.)
  
$ su -c "livecd-iso-to-disk --format --reset-mbr ''/path/to/ISO'' /dev/''USBPARTITIONNAME''"
+
==== Data persistence ====
  
==== Data Persistence ====
+
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 that kernel updates require [[#Kernel updates|manual intervention]] and [[#limited overlay|overlay space may be insufficient]]. The primary use of this feature is booting a USB stick with your live image as well as the persistent changes. Note that you will need to have space on your target USB stick for the live image plus your overlay plus any other data you want on the stick.
  
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 the ''Graphical Method'' described above to do this easily. There is a graphical slider in the interface you can use to assign space on the target stick for persistent storage.
  
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 using the ''livecd-iso-to-disk'' tool, add the {{Code|--overlay-size-mb}} parameter to add a persistent data storage area to the target stick. For example:
  
If you prefer the command line, you can run the following command:
+
: {{Code|su -c "livecd-iso-to-disk --overlay-size-mb 512 Fedora-16-x86_64-Live-Desktop.iso /dev/USBPARTITIONNAME"}}
  
$ 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]]'' tool will not accept an overlay size value greater than 4095 for VFAT, but for ext[234] filesystems it is only limited by the available space.
 +
{{anchor|limited overlay}}
 +
{{admon/note | Limited Lifetime of Persistent Overlay | One very important note about using the "primary" persistent overlay for system changes is that due to the way it's currently implemented (as a [[wikipedia:Device mapper|Device-mapper]] copy-on-write snapshot), every single change to it (writes AND deletes) subtracts from its free space, so it will eventually be "used up" and your USB stick will no longer boot (see this [http://thread.gmane.org/gmane.linux.kernel.device-mapper.devel/14644 dm-devel discussion] and [[LiveOS_image#Overlay_recovery|this page]] for emergency recovery). Because of these limitations, it is advisable to use the system-level persistence sparingly, for configuration changes and important security updates only. Or, if you have sufficient disk space available, changes to the LiveOS root filesystem snapshot can be merged into a new copy of the root filesystem.  See [[LiveOS image#Merge overlay into new image|this page section]] for instructions.
  
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[23] 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.
+
See [[#Mounting a Live USB filesystem|this section]] for mounting the root filesystem outside of a boot.
 
+
{{admon/note | Limited Lifetime of Persistent Overlay | One very important note about using the "primary" persistent overlay for system changes is that due to the way it's currently implemented (as a LVM copy-on-write snapshot), every single change to it (writes AND deletes) subtracts from its free space, so it will eventually be "used up" and your USB stick will no longer boot (see this [http://thread.gmane.org/gmane.linux.kernel.device-mapper.devel/14644 dm-devel discussion] and [http://wiki.sugarlabs.org/go/LiveOS_image#Overlay_recovery this page] for emergency recovery). Because of these limitations, it is advisable to use the system-level persistence sparingly, for configuration changes and important security updates only. For a truly persistent write-many (vs write-once) overlay, use the ''--home-size-mb'' option to create a home directory filesystem image for personal files. Unlike the primary system overlay image, the home.img can be re-used and loop mounted outside of the liveusb environment.}}
+
  
 +
For normal, write-many storage, use the {{Code|--home-size-mb}} option to create a home directory filesystem for personal files. Home.img can be re-used and loop mounted outside of the Live USB environment.}}
 
The persistent overlay status may be queried by issuing this command on the live system:
 
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
+
: {{Code|dmsetup status live-rw}}
 +
 
 +
The returned value may look like this:
 +
<pre>
 +
live-rw: 0 8388608 snapshot 42296/204800 176
 +
</pre>
  
 
where the fraction after 'snapshot' for the logical volume is that of 512-byte sectors consumed in the overlay.
 
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 ==
+
= Windows instructions =
  
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:
+
== Using {{command|liveusb-creator}} ==
  
<pre>
+
[[Image:Liveusb-creator.png]]
# livecd-iso-to-disk /dev/sr0 /dev/USBPARTITIONNAME
+
</pre>
+
From a running Live USB, use /dev/live as the source:
+
<pre>
+
# livecd-iso-to-disk /dev/live /dev/USBPARTITIONNAME
+
</pre>
+
  
== How to Boot a Live USB Drive ==
+
Fedora USB sticks can be created using the [http://fedorahosted.org/liveusb-creator liveusb-creator] utility. Note that this utility is only capable of writing Live images.
  
 +
* Download liveusb-creator from [http://fedorahosted.org/liveusb-creator the site]
 +
* Double click ''liveusb-creator''
 +
 +
To use the tool, simply select a Fedora release to download from the drop-down box at top-right (or select an ISO you have already downloaded using the ''Browse'' button at top-left), select the USB stick to which you wish to write the image from the ''Target Device'' drop-down box, and hit the ''Create Live USB'' button.
 +
 +
= Booting the image =
 +
[[Image:Bios_USB_boot.jpg|thumb|right|Set USB as first boot device. Your BIOS may be different.]]
 
* Power off the computer.
 
* Power off the computer.
 
* Plug the USB drive into a USB port.
 
* Plug the USB drive into a USB port.
Line 264: Line 225:
 
** Save the changes, exit, and the computer should boot the Live USB drive.
 
** Save the changes, exit, and the computer should boot the Live USB drive.
  
{{Anchor|dvd2usb}}
+
= Troubleshooting =
 
+
== How to Make a bootable USB Drive to Install Fedora instead of using a physical DVD ==
+
{{admon/important|Requires livecd-tools 16.11 |Please ensure that you have the latest version of livecd-tools before attempting this: Known bug #[[rhbug:812141|812141]]}}
+
 
+
=== 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 ===
+
 
+
{{admon/note|Formatting is necessary|Due to some changes in the anaconda installer in Fedora 17, it is necessary to format the USB media that you are using. This is only required when using the DVD media, not the Live media. It is therefore suggested that you use a 4-8GB pen drive and not an external hard disk since you will lose your data. See rhbz#813905}}
+
 
+
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 [http://fedoraproject.org/en/get-fedora-all].  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:
+
<pre>
+
yum install livecd-tools
+
</pre>
+
 
+
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:
+
<pre>
+
# livecd-iso-to-disk --format --reset-mbr --msdos path-to/Fedora-*.iso /dev/sdb
+
</pre>
+
 
+
You can also use direct dd copy
+
<pre>
+
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 ===
+
== liveusb-creator problems ==
  
* Try the [https://fedorahosted.org/liveusb-creator/wiki/FAQ liveusb-creator FAQ].
+
* Try the [http://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.
 
* 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.
 
* 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.
Line 315: Line 237:
 
If you get the following message, you need to mark the partition bootable.
 
If you get the following message, you need to mark the partition bootable.
 
<pre>
 
<pre>
$ livecd-iso-to-disk Fedora-<release>-Live-i686.iso /dev/sdb1
+
$ su -c "livecd-iso-to-disk Fedora-1-x86_64-Live-Desktop.iso /dev/sdX"
 
Partition isn't marked bootable!
 
Partition isn't marked bootable!
 
You can mark the partition as bootable with  
 
You can mark the partition as bootable with  
     $ /sbin/parted /dev/sdb
+
     $ /sbin/parted /dev/sdX
 
     (parted) toggle N boot
 
     (parted) toggle N boot
 
     (parted) quit
 
     (parted) quit
Line 324: Line 246:
 
</pre>
 
</pre>
  
To mark the partition bootable,
+
To mark the partition bootable, run parted, and use the 'toggle X boot' command. For example:
 
<pre>
 
<pre>
$ parted /dev/sdb
+
$ parted /dev/sdX
 
GNU Parted 1.8.6
 
GNU Parted 1.8.6
Using /dev/sdb
+
Using /dev/sdX
 
Welcome to GNU Parted! Type 'help' to view a list of commands.
 
Welcome to GNU Parted! Type 'help' to view a list of commands.
 
(parted) print                                                             
 
(parted) print                                                             
 
Model: Imation Flash Drive (scsi)
 
Model: Imation Flash Drive (scsi)
Disk /dev/sdb: 1062MB
+
Disk /dev/sdX: 1062MB
 
Sector size (logical/physical): 512B/512B
 
Sector size (logical/physical): 512B/512B
 
Partition Table: msdos
 
Partition Table: msdos
Line 342: Line 264:
 
(parted) print                                                     
 
(parted) print                                                     
 
Model: Imation Flash Drive (scsi)
 
Model: Imation Flash Drive (scsi)
Disk /dev/sdb: 1062MB
+
Disk /dev/sdX: 1062MB
 
Sector size (logical/physical): 512B/512B
 
Sector size (logical/physical): 512B/512B
 
Partition Table: msdos
 
Partition Table: msdos
Line 357: Line 279:
 
If you get the following message, you need to label the partition.
 
If you get the following message, you need to label the partition.
 
<pre>
 
<pre>
$ livecd-iso-to-disk Fedora-<release>-Live-i686.iso /dev/sdb1
+
$ su -c "livecd-iso-to-disk Fedora-16-x86_64-Live-Desktop.iso /dev/sdX"
 
Need to have a filesystem label or UUID for your USB device
 
Need to have a filesystem label or UUID for your USB device
 
Label can be set with /sbin/dosfslabel
 
Label can be set with /sbin/dosfslabel
Line 363: Line 285:
 
</pre>
 
</pre>
  
To label the partition.
+
To label the partition:
 
<pre>
 
<pre>
$ dosfslabel /dev/sdb1 usbdisk
+
su -c "dosfslabel /dev/sdX LIVE"
 
</pre>
 
</pre>
  
 
=== Partition has different physical/logical endings! ===
 
=== Partition has different physical/logical endings! ===
  
If you get the following message, you may need to reformat the flash drive.
+
If you get this message from fdisk, you may need to reformat the flash drive, as described earlier in this guide.
<pre>
+
$ 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)
+
</pre>
+
  
 
=== MBR appears to be blank! ===
 
=== 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.
+
If your test boot reports a corrupted boot sector, or you get the following message, you need to install or reset the master boot record (MBR).
 
<pre>
 
<pre>
$ livecd-iso-to-disk Fedora-<release>-Live-i686.iso /dev/sdb1
+
$ su -c "livecd-iso-to-disk Fedora-17-x86_64-Live-Desktop.iso /dev/sdX"
 
MBR appears to be blank.
 
MBR appears to be blank.
 
You can add an MBR to this device with
 
You can add an MBR to this device with
Line 394: Line 304:
 
</pre>
 
</pre>
  
 +
To install or reset MBR:
 +
$ su -c "livecd-iso-to-disk --reset-mbr Fedora-17-x86_64-Live-Desktop.iso /dev/sdX"
  
To install MBR,
+
== Issues using other Linux distributions ==
<pre>
+
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 to have a Debian layout, with a /.disk/info file and a casper directory. Do not attempt to use this utility to write a Fedora ISO image.
$ cat /usr/share/syslinux/mbr.bin > /dev/sdb
+
</pre>
+
  
=== SYSLINUX Boot Error! ===
+
The livecd-iso-to-disk script is not meant to be run from a non-Fedora system. Even if it happens to run and write a stick apparently successfully from some other distribution, the stick may well fail to boot. Use of livecd-iso-to-disk on any distribution other than Fedora is unsupported and not expected to work: please use an alternative method, such as {{command | dd}} described above.
  
If you were using the script on previous Red Hat or Fedora Release and getting following error message,
+
= Testing Live Image on USB =
<pre>
+
SYSLINUX 3.xx ... EBIOS Load error - Boot error
+
</pre>
+
  
You may need to upgrade your syslinux to 3.50 or higher from Peter Anvin's [http://syslinux.zytor.com/faq.php SYSLINUX] .
+
You can test your Live Image on USB using QEMU as shown in the screenshot below.
  
* http://www.kernel.org/pub/linux/utils/boot/syslinux/RPMS/i386/
+
[[Image:Screenshot_qemu_gtk3.png‎|thumb]]
  
=== Ubuntu issues ===
+
For example, you could type the following commands:
Ubuntu and derivative Linux distributions have a usb-creator program similar to Live USB Creator.
+
<pre>
This ''does not work'' with Fedora .iso images, it silently rejects them.
+
su -c 'umount /dev/sdX1'
(usb-creator requires the .iso has a Debian layout, with a /.disk/info file and a casper directory.)
+
qemu -hda /dev/sdX -m 1024 -vga std
 +
</pre>
 +
= Mounting a Live USB filesystem =
  
The livecd-iso-to-disk script isn't meant to be run from a non-Fedora system.
+
You can use the [https://git.fedorahosted.org/cgit/livecd/tree/tools/liveimage-mount '''''liveimage-mount'''''] script in the {{package|livecd-tools}} package to mount an attached Live USB device or other LiveOS image, such as an 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.
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 #[[rhbug:699554|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).
+
= Kernel updates =
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 ==
+
If you have [[#limited overlay|sufficient overlay space]] to accommodate a kernel update on a Live USB installation, the kernel and initramfs will be installed to the /boot directory.  To put these into service they must be moved to the /syslinux directory of the installation partition.  This is accessible from the running Live USB filesystem at either the /mnt/live or /run/initramfs/live mount point. The new initramfs (such as initramfs-3.3.2-6.fc16.x86_64.img) and kernel (such as vmlinuz-3.3.2-6.fc16.x86_64) should be moved to replace the /mnt/live/syslinux/initrd0.img and /mnt/live/syslinux/vmlinuz0 files, respectively.
 +
* '''Note''': Beginning with Fedora 17 and updated Fedora 16, [[dracut]] no longer includes the dmsquash-live module by default. So one should include it in {{Code|/etc/dracut.conf}} with, for example,<br><pre># echo 'add_dracutmodules+=" dmsquash-live "' >> /etc/dracut.conf</pre>
  
You can test your Live Image on USB using QEMU as shown in the screenshot below.
+
The following commands will move the new kernel and initramfs files and create symbolic links to them, in case one later wants to perform a full install of the image to a hard disk. 
 +
<nowiki>bootpath=run/initramfs/live/syslinux
 +
# bootpath=mnt/live/syslinux
 +
new=3.3.2-6.fc16.x86_64
  
[[Image:FedoraLiveCD_USBHowTo_usb_flash_with_qemu.png|thumb]]
+
cd /
 
+
mv -f boot/vmlinuz-$new ${bootpath}/vmlinuz0
For example, if your USB flash drive is on /dev/sdb1, you could type following command:
+
mv -f boot/initramfs-${new}.img ${bootpath}/initrd0.img
 
+
<pre>
+
$ umount /dev/sdb1
+
$ qemu -hda /dev/sdb -m 256 -vga std
+
</pre>
+
== Mounting a Live USB filesystem ==
+
  
You can use the [http://git.fedorahosted.org/git?p=hosted/livecd;a=blob_plain;f=tools/liveimage-mount;hb=HEAD '''''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.
+
ln -fs -T ../${bootpath}/vmlinuz0 boot/vmlinuz-$new
 +
ln -fs -T ../${bootpath}/initrd0.img boot/initramfs-${new}.img</nowiki>
  
== See also ==
+
= See also =
 
[http://www.redhatmagazine.com/2007/11/07/i-am-fedora-and-so-can-you/ Red Hat Magazine | I am Fedora, and so can you!]
 
[http://www.redhatmagazine.com/2007/11/07/i-am-fedora-and-so-can-you/ Red Hat Magazine | I am Fedora, and so can you!]
  
== References ==
+
= References =
  
 
* http://www.redhat.com/archives/fedora-test-list/2007-May/msg00308.html
 
* http://www.redhat.com/archives/fedora-test-list/2007-May/msg00308.html
 
* http://www.redhat.com/archives/fedora-livecd-list/2007-April/msg00029.html
 
* http://www.redhat.com/archives/fedora-livecd-list/2007-April/msg00029.html

Revision as of 08:33, 13 December 2013

Artwork DesignService fedora-iso-usb.png

This page explains how to create and use Fedora 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.

With current Fedora releases you can also write the non-live Fedora installation images (the DVD and network installation images) to a USB stick, which many users find more convenient and faster than writing to an actual optical disc.

Note.png
Quick start
The process for most people is simple. Almost all USB sticks are provided by hardware manufacturers ready to use with this process. If you have any documents on your USB stick, it's not a bad idea to back them up before you start.

Then reboot your system and use your computer's built-in function to choose the USB boot device -- usually this is a special key you hold down at boot time, such as F12. Then enjoy!

If you are into technical details or want more information on alternative tools and advanced usage, please read on.

Contents


Important.png
Creating Live CD ISO image
A Live USB system is created from the same ISO image file that is used to create Live CD/DVD media. You can download ISO images for the official Fedora release from the Fedora download site. Consult How to create and use a Live CD for more information on creating your own customized ISO image file.

System Requirements

  • A working computer running GNU/Linux, Windows or MacOS.
  • A USB flash drive, also known as USB stick, thumb drive, pen drive, or jump drive, with 1 GB or more of storage space.
  • A Fedora ISO file, which you can download from http://fedoraproject.org/get-fedora.

Ability to boot from USB media

  • 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 its 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.

GNU/Linux instructions

Identifying your USB disk

The first step is to identify the name of the USB drive partition.

  • Insert the USB stick into a USB port.
  • Open a terminal and run dmesg.
  • You will see something like
[32656.573467] sd 8:0:0:0: [sdX] Attached SCSI removable disk

where sdX will be sdb, sdc, sdd, etc. Take note of this label as it is the name of the disk you will use. We'll call it sdX from now on.

Checking USB disk size

As noted before, the disk must have at least 1 GB of storage space. You can check this by running the df -h command. Look for a line like the following:

/dev/sdX1             3.9G  4.0K  3.9G   1% /media/usbdisk

and make sure the first column reads more than 1.0G.

You can also use a file manager like nautilus, by right clicking and selecting Properties:

Properties USB size.png

Writing the image

Graphical method: using liveusb-creator (Windows/Fedora only)

Fedora Live USB creator.png

Fedora USB sticks can be created using the liveusb-creator utility. Note that this utility is only capable of writing Live images.

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 search liveusb-creator on the GNOME activities overview.

To use the tool, simply select a Fedora release to download from the drop-down box at top-right (or select an ISO you have already downloaded using the Browse button at top-left), select the USB stick to which you wish to write the image from the Target Device drop-down box, and hit the Create Live USB button.

Another graphical method: using UNetbootin

Warning (medium size).png
About UNetbootin
Following each release, Fedora support volunteers receive reports of problems with installation images created by UNetbootin. Using the most recent version of UNetbootin available has been known to improve results.
  1. There is no persistent storage for operating or user filesystem changes with this installation method for Fedora—any file changes on those filesystems will be lost on shutdown. (Files written to the USB device filesytem, mounted at /run/initramfs/live, are persistent.)
  2. It is easiest to start with an empty device filesystem—a device with another Live installation can leave files that interfere with the new installation.
While your results may vary, it is usually the case that the liveusb-creator, livecd-iso-to-disk, and dd methods give better results than UNetbootin. If you encounter problems with UNetbootin, please contact the UNetbootin developers, not the Fedora developers.

UNetbootin is a graphical, bootable USB image creator. Using it will allow you to preserve any data you have in the USB drive.

Unetbootin gtk3.png

  • Download UNetbootin latest version from http://unetbootin.sourceforge.net/ and install it.
  • You might have to type the root password when running it.
  • Click on Diskimage and search for the ISO file you downloaded.
  • Select Type: USB drive and choose sdX drive.
  • Press OK.
Note.png
Note
If you do not see sdX listed, you might have to reformat the drive, effectively loosing all your data on the drive:
su -c "umount /dev/sdX"
su -c "mkfs.vfat -I /dev/sdX"
.

Simple command line method: write the image directly

Warning (medium size).png
CAUTION
This will erase all data on the USB drive! Please read the instructions below carefully and make sure you write the right drive label (sdX).

To write the ISO file directly to the disk, run:

su -c "dd if=/Users/me/Downloads/Fedora-17-x86_64-DVD.iso of=/dev/sdX bs=8M"

Or, if you are running an Ubuntu-based distribution

sudo dd if=/Users/me/Downloads/Fedora-17-x86_64-DVD.iso of=/dev/sdX bs=8M

Note that the process will take some time and you will not see any information while it is running.

Command line method: Using the livecd-iso-to-disk tool (Fedora only)

The livecd-iso-to-disk is the most capable, non-destructive, and often most reliable method of writing a Fedora ISO image to a USB stick, but it can be used reliably only from within Fedora. It does not work in Windows and is not supported (and will usually fail) in non-Fedora distributions. Please use the liveusb-creator tool, dd (or an equivalent tool), or a third-party tool such as UNetbootin on other operating systems. It is also not a good idea to try and write a new Fedora release using the version of livecd-iso-to-disk in a much older Fedora release: It is best to only use a release a maximum of two versions older than the release you are trying to write.

Make sure the livecd-tools RPM is installed with the command

rpm -q livecd-tools.

You will see the name of the RPM and a version number if it is installed, or no output if it is not installed.

If livecd-tools is not installed, install it using this command, or PackageKit:

su -c 'yum install livecd-tools'

Detailed usage information is available in the first pages of the livecd-iso-to-disk script, which you can also see by running this command:

su -c 'livecd-iso-to-disk --help'

Basic examples follow.

To make an existing USB stick bootable as a Fedora image—without deleting any of the data on it—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 Fedora-17-x86_64-Live-Desktop.iso /dev/sdX"

See Data persistence below for how to create Live USB devices with more than temporary storage of user files and settings.

In case it is not possible to boot from a disk created with the method shown above, before re-partitioning and re-formatting, often resetting the master boot record will enable booting:

su -c "livecd-iso-to-disk --reset-mbr Fedora-17-x86_64-Live-Desktop.iso /dev/sdX"
Warning (medium size).png
CAUTION:
Using the --format option in the following command will erase all data on the USB drive! Please read the instructions below carefully.
If necessary, you can have livecd-iso-to-disk re-partition and re-format the target stick:
su -c "livecd-iso-to-disk --format --msdos --reset-mbr Fedora-17-x86_64-Live-Desktop.iso /dev/sdX"

UEFI boot of USB sticks

Whether a Fedora image written to a USB stick will be bootable natively via UEFI is a somewhat complex question which depends on the Fedora release, the type of image (live or non-live), and the method used to write it. The --efi parameter to the livecd-iso-to-disk tool attempts to make a stick written with that tool natively UEFI bootable.

As of Fedora 17, all images written using the dd method should be UEFI-bootable, and all images written with livecd-iso-to-disk --format --reset-mbr --efi should also be UEFI-bootable. Use of --efi without --format and --reset-mbr can be considered a 'best effort', and may not produce a UEFI-bootable stick.

Creating a USB stick from a running live environment

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

su -c "livecd-iso-to-disk /run/initramfs/livedev /dev/sdX"

(For versions before Fedora 17, use /dev/live instead of /run/initramfs/livedev.)

Data persistence

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 that kernel updates require manual intervention and overlay space may be insufficient. The primary use of this feature is booting a USB stick with your live image as well as the persistent changes. Note that you will need to have space on your target USB stick for the live image plus your overlay plus any other data you want on the stick.

Use the Graphical Method described above to do this easily. There is a graphical slider in the interface you can use to assign space on the target stick for persistent storage.

If using the livecd-iso-to-disk tool, add the --overlay-size-mb parameter to add a persistent data storage area to the target stick. For example:

su -c "livecd-iso-to-disk --overlay-size-mb 512 Fedora-16-x86_64-Live-Desktop.iso /dev/USBPARTITIONNAME"

where 512 is the desired size (in megabytes) of the overlay. The livecd-iso-to-disk tool will not accept an overlay size value greater than 4095 for VFAT, but for ext[234] filesystems it is only limited by the available space.

Note.png
Limited Lifetime of Persistent Overlay
One very important note about using the "primary" persistent overlay for system changes is that due to the way it's currently implemented (as a Device-mapper copy-on-write snapshot), every single change to it (writes AND deletes) subtracts from its free space, so it will eventually be "used up" and your USB stick will no longer boot (see this dm-devel discussion and this page for emergency recovery). Because of these limitations, it is advisable to use the system-level persistence sparingly, for configuration changes and important security updates only. Or, if you have sufficient disk space available, changes to the LiveOS root filesystem snapshot can be merged into a new copy of the root filesystem. See this page section for instructions.

See this section for mounting the root filesystem outside of a boot.

For normal, write-many storage, use the --home-size-mb option to create a home directory filesystem for personal files. Home.img can be re-used and loop mounted outside of the Live USB environment.

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.

Windows instructions

Using liveusb-creator

Liveusb-creator.png

Fedora USB sticks can be created using the liveusb-creator utility. Note that this utility is only capable of writing Live images.

  • Download liveusb-creator from the site
  • Double click liveusb-creator

To use the tool, simply select a Fedora release to download from the drop-down box at top-right (or select an ISO you have already downloaded using the Browse button at top-left), select the USB stick to which you wish to write the image from the Target Device drop-down box, and hit the Create Live USB button.

Booting the image

Set USB as first boot device. Your BIOS may be different.
  • 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.

Troubleshooting

liveusb-creator problems

Partition isn't marked bootable!

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

$ su -c "livecd-iso-to-disk Fedora-1-x86_64-Live-Desktop.iso /dev/sdX"
Partition isn't marked bootable!
You can mark the partition as bootable with 
    $ /sbin/parted /dev/sdX
    (parted) toggle N boot
    (parted) quit
Cleaning up to exit...

To mark the partition bootable, run parted, and use the 'toggle X boot' command. For example:

$ parted /dev/sdX
GNU Parted 1.8.6
Using /dev/sdX
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: Imation Flash Drive (scsi)
Disk /dev/sdX: 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/sdX: 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.

$ su -c "livecd-iso-to-disk Fedora-16-x86_64-Live-Desktop.iso /dev/sdX"
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:

su -c "dosfslabel /dev/sdX LIVE"

Partition has different physical/logical endings!

If you get this message from fdisk, you may need to reformat the flash drive, as described earlier in this guide.

MBR appears to be blank!

If your test boot reports a corrupted boot sector, or you get the following message, you need to install or reset the master boot record (MBR).

$ su -c "livecd-iso-to-disk Fedora-17-x86_64-Live-Desktop.iso /dev/sdX"
MBR appears to be blank.
You can add an MBR to this device with
Cleaning up to exit...

To install or reset MBR:

$ su -c "livecd-iso-to-disk --reset-mbr Fedora-17-x86_64-Live-Desktop.iso /dev/sdX"

Issues using other Linux distributions

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 to have a Debian layout, with a /.disk/info file and a casper directory. Do not attempt to use this utility to write a Fedora ISO image.

The livecd-iso-to-disk script is not meant to be run from a non-Fedora system. Even if it happens to run and write a stick apparently successfully from some other distribution, the stick may well fail to boot. Use of livecd-iso-to-disk on any distribution other than Fedora is unsupported and not expected to work: please use an alternative method, such as dd described above.

Testing Live Image on USB

You can test your Live Image on USB using QEMU as shown in the screenshot below.

Screenshot qemu gtk3.png

For example, you could type the following commands:

su -c 'umount /dev/sdX1'
qemu -hda /dev/sdX -m 1024 -vga std

Mounting a Live USB filesystem

You can use the liveimage-mount script in the Package-x-generic-16.pnglivecd-tools package to mount an attached Live USB device or other LiveOS image, such as an 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.

Kernel updates

If you have sufficient overlay space to accommodate a kernel update on a Live USB installation, the kernel and initramfs will be installed to the /boot directory. To put these into service they must be moved to the /syslinux directory of the installation partition. This is accessible from the running Live USB filesystem at either the /mnt/live or /run/initramfs/live mount point. The new initramfs (such as initramfs-3.3.2-6.fc16.x86_64.img) and kernel (such as vmlinuz-3.3.2-6.fc16.x86_64) should be moved to replace the /mnt/live/syslinux/initrd0.img and /mnt/live/syslinux/vmlinuz0 files, respectively.

  • Note: Beginning with Fedora 17 and updated Fedora 16, dracut no longer includes the dmsquash-live module by default. So one should include it in /etc/dracut.conf with, for example,
    # echo 'add_dracutmodules+=" dmsquash-live "' >> /etc/dracut.conf

The following commands will move the new kernel and initramfs files and create symbolic links to them, in case one later wants to perform a full install of the image to a hard disk.

bootpath=run/initramfs/live/syslinux
# bootpath=mnt/live/syslinux
new=3.3.2-6.fc16.x86_64

cd /
mv -f boot/vmlinuz-$new ${bootpath}/vmlinuz0
mv -f boot/initramfs-${new}.img ${bootpath}/initrd0.img

ln -fs -T ../${bootpath}/vmlinuz0 boot/vmlinuz-$new
ln -fs -T ../${bootpath}/initrd0.img boot/initramfs-${new}.img

See also

Red Hat Magazine | I am Fedora, and so can you!

References