From Fedora Project Wiki
mNo edit summary
mNo edit summary
Line 8: Line 8:
现在的Fedora版本中,你也可以把非自生Fedora镜像(DVD和网络安装镜像)写入U盘,有些用户觉得这样更方便,而且比写入光盘更快。
现在的Fedora版本中,你也可以把非自生Fedora镜像(DVD和网络安装镜像)写入U盘,有些用户觉得这样更方便,而且比写入光盘更快。


{{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 | 方法对大多数人都很简单。大多数厂商制造的U盘都适用。如果U盘中有文件,最好先''备份''一下。


* Download the '''LiveUSB Creator''' program from http://fedorahosted.org/liveusb-creator if you're on Windows, or install on your Linux system using PackageKit or yum.
* Windows用户从 http://fedorahosted.org/liveusb-creator下载'''LiveUSB Creator''',Linux用户使用PackageKit或者yum安装。
* Download the Live ISO image from http://fedoraproject.org/get-fedora.
* 从http://fedoraproject.org/get-fedora下载镜像。
* Insert your stick and run the '''LiveUSB Creator''' program.
* 插入U盘并启动'''LiveUSB Creator'''程序。


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!
重启电脑使用机器内置的方式选择USB启动设备-- 通常是在启动时按下特定的键, 比如'''F12'''。 然后你可以开始试用了!!


If you are into technical details or want more information on alternative tools and advanced usage, please read on.}}
如果你想获得技术上的细节,或者想获得更多关于可以选择的工具以及高级用法,读下面的内容。 }}


__TOC__
__TOC__
Line 32: Line 32:
鉴于不同的BIOS的功能有所差别,部分电脑不能USB启动。如果你恰好在此列,考虑其他安装介质(光盘、硬盘等)。如果你不确定是否能够USB启动,又不介意下载并刻录Fedora镜像到你的USB设备(可能会擦除你的数据),不妨一试,最多浪费一点时间
鉴于不同的BIOS的功能有所差别,部分电脑不能USB启动。如果你恰好在此列,考虑其他安装介质(光盘、硬盘等)。如果你不确定是否能够USB启动,又不介意下载并刻录Fedora镜像到你的USB设备(可能会擦除你的数据),不妨一试,最多浪费一点时间


* U盘自身问题可能导致此过程失败,注意查看错误信息。


If your USB stick is not in working order, this procedure may fail.  Watch for error messages during the process.
= GNU/Linux下方法 =


=== Sufficiently large USB stick ===
== 定位你的U盘 ==


Many USB sticks indicate the size on the packaging or the outside of the stick.
首先找到U盘分区号


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 {{command|df -h}}:
* Insert the USB stick into a USB port.
<pre>
$ 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
</pre>
 
USB drives are usually mounted in {{filename|/media}} or {{filename|/run/media/username/}}.  In this case, the device is /dev/sdb1, has a 3.9GB capacity and is almost empty. As a rule of thumb, you should use a stick of at least 1GB to write a live image or network install image, and a stick of at least 4GB to write a DVD image.
 
Take note of {{filename|/dev/sdb1}} or equivalent; you will be specifying the device name if you use the command line method. This is the string you substitute for USBPARTITIONNAME where it occurs in the instructions below.
 
== Optional: re-partition and format your USB stick ==
 
If you have a USB stick with a FAT-formatted partition that has a decent amount of free space, you can skip the repartitioning and formatting steps below, and simply continue with the following steps. This should allow you to add the Fedora live image to the stick without destroying any of the data already on it. However, '''it is highly recommended to make a backup copy of the data on the USB drive before proceeding''' in case something goes wrong.
 
If you have any trouble trying the non-destructive installation path, try first to reset the master boot record, MBR, with the {{command|--reset-mbr}} option.


Occasionally, a filesystem can be damaged and re-partitioning and re-formatting before writing the stick may be necessary.  Otherwise, it is [http://wiki.laptop.org/go/How_to_Damage_a_FLASH_Storage_Device recommended to keep the factory formatting] of flash media devices.  
* Open a terminal and run {{command|dmesg}}.
=== How to re-partition ===


{{admon/warning | CAUTION | This will erase all data on the USB drive!  Please read the instructions below ''carefully''.}}
* You will see something like


{{admon/note | Skip if using command-line method | If you intend to use the livecd-iso-to-disk tool, documented below, you can skip this step and the ''How to Format'' step below, and simply pass the {{command|--format}} {{command|--msdos}} and {{command|--reset-mbr}} parameters to that tool if you need to re-partition and/or re-format the stick.}} <!-- msdos formatting is no longer the default. -->
If the drive has not been partitioned properly (or if you are unsure), use {{command|fdisk}} to repartition it.
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:
<pre>
<pre>
su -c 'fdisk /dev/sdb'
[32656.573467] sd 8:0:0:0: [sdX] Attached SCSI removable disk
</pre>
</pre>
If you don't have fdisk installed, run {{command| su -c 'yum install util-linux-ng'}} to install it.


The following session output from {{command|fdisk}} 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. The ''d'' command deletes an existing partition; the ''n'' command creates a new partition; the ''t'' command sets the type of a partition; and the ''w'' command commits your changes (at any point before running the ''w'' command, you can quit fdisk without any changes actually being made to the 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.
<pre>
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.
</pre>
=== How to re-format ===


{{admon/warning | CAUTION | This will erase all data on the USB drive!  Please read the instructions below ''carefully''.}}
== Checking USB disk size ==


To finish, the partition must be formatted with an actual file system using {{command|mkfs.vfat}} as the root user. Unmount the device before using {{command|mkfs.vfat}}. In the below example, {{filename|/dev/USBPARTITIONNAME}} might be, for example, {{filename|/dev/sdb1}}.  '''''Be sure to select the correct partition; formatting destroys all data on it!'''''
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>
su -c 'umount /dev/USBPARTITIONNAME'
/dev/sdX1            3.9G  4.0K  3.9G  1% /media/usbdisk
su -c 'mkfs.vfat -F 32 -n usbdisk /dev/USBPARTITIONNAME'
</pre>
</pre>


If you don't have mkfs.vfat installed, run "yum install dosfstools" as root.
and make sure the first column reads more than 1.0G.


== Download an ISO ==
You can also use a file manager like {{command | nautilus}}, by right clicking and selecting ''Properties'':


(If you intend to use the "Graphical" method below, with a supported Fedora release, you can skip this step. The program will download the ISO for you.)
[[image:Properties_USB_size.png]]


You can use BitTorrent or your web browser to download a bootable image, or ISO, which you will install on your USB drive.
== Writing the image ==


Quick links:
=== Graphical method: using {{command|liveusb-creator}} (Windows/Fedora only) ===
* [http://fedoraproject.org/en/get-fedora Supported releases]
* [http://fedoraproject.org/get-prerelease Pre-releases] (Alpha and Beta; redirects to previous supported release during pre-Alpha phase)
* [http://alt.fedoraproject.org/pub/alt/nightly-composes/desktop/ Nightly test composes]


You are looking for a file with "Live" in the name, usually of the form {{filename|Fedora-<version>-<architecture>-Live-Desktop.iso}}.  For example, {{filename|Fedora-{{FedoraVersionNumber}}-x86_64-Live-Desktop.iso}} is the {{FedoraVersion|short}} release 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.
[[Image:Fedora_Live_USB_creator.png]]


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


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.
You can use Add/Remove Programs and search for ''liveusb-creator'', or use the command line:
 
The nightly test composes will be built from the [[Releases/Branched|Branched]] release when there is one, and from [[Releases/Rawhide|Rawhide]] when there is no Branched.
 
== Write the stick ==
 
=== Graphical Method - Windows or Fedora ===
 
Fedora USB sticks can be created in Windows and Linux using the [http://fedorahosted.org/liveusb-creator liveusb-creator] utility. Note that this utility is only capable of writing Live images. It is possible to write non-live images to a USB stick, but you must use one of the two command-line methods documented below.
 
For Windows using the following steps:
* Download liveusb-creator from [http://fedorahosted.org/liveusb-creator the site]
* 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:
<pre>
<pre>
su -c 'yum install liveusb-creator'
su -c 'yum install liveusb-creator'
</pre>
</pre>


To start, run {{command|liveusb-creator}} on the command line, or on the GNOME menu, go to ''Applications -> System Tools -> liveusb-creator''.
To start, run {{command|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.
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.


=== Command Line Methods ===
=== Another graphical method: using Unetbootin ===


In the following examples, replace {{filename|/path/to/ISO}} with e.g. {{filename|Fedora-16-x86_64-Live-Desktop.iso}} or the full path to the ISO you downloaded, e.g. {{filename|/tmp/Fedora-16-x86_64-Live-Desktop.iso}}.
{{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. While your results may vary, for best results, use the liveusb-creator. If you encounter problems with Unetbootin, please contact the Unetbootin developers, not the Fedora developers.}}


Replace {{filename|/dev/USBPARTITIONNAME}} with the appropriate partition name. For example, {{filename|/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!'''''
Unetbootin is a graphical bootable USB image creator. Using it will allow you to preserve any data you have in the USB drive.


Both of these methods work with all Fedora images, not just live images: you can use {{command|dd}} or {{command|livecd-iso-to-disk}} to write a Fedora DVD or network installation ISO to a USB stick. However, for Fedora 15, non-live images cannot be written using {{command|dd}}.
[[Image:Unetbootin_gtk3.png]]


==== Using dd for a direct copy ====
* 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.


{{admon/warning | CAUTION | This will erase all data on the USB drive!  Please read the instructions below ''carefully''.}}
{{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>.}}
 
=== Simple command line method: write the image directly ===
 
{{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)''.}}
 
To write the ISO file directly to the disk, run:


You can simply use dd (or similar direct imaging tools for other operating systems) to write a Fedora ISO to USB, although the specialized tools have additional features like non-destructive writing and data persistence. dd will always destroy any other data on the target stick, and cannot provide a persistent environment.
<pre>
<pre>
su -c 'dd if=Fedora-16-x86_64-Live-Desktop.iso of=/dev/sd''X'' bs=8M'
su -c "dd if=/Users/me/Downloads/Fedora-17-x86_64-DVD.iso of=/dev/sdX bs=8M"
</pre>
</pre>


On "OS X" something like this should work:
Or, if you are running an Ubuntu-based distribution
 
<pre>
<pre>
sudo dd if=/Users/me/Downloads/Fedora-17-x86_64-DVD.iso of=/dev/disk999 bs=8388608
sudo dd if=/Users/me/Downloads/Fedora-17-x86_64-DVD.iso of=/dev/sdX bs=8M
</pre>
</pre>


Note that in this specific case you want the device name (e.g. /dev/sdb) not the partition name (e.g. /dev/sdb1).
Note that the process will take some time and you will not see any information while it is running.
 
=== Command line method: Using the {{command|livecd-iso-to-disk}} tool (Fedora only) ===
 
{{admon/note | Copying from a LiveCD | 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:


An equivalent for Windows is the [http://www.chrysocome.net/rawwrite RawWrite for Windows tool]. It should be capable of writing Fedora images much as described above, but this is not regularly tested.
su -c "livecd-iso-to-disk /run/initramfs/livedev /dev/sdX"


In Fedora versions prior to {{FedoraVersion|long|17}}, a DVD image written to a USB stick with dd or an equivalent tool will function as a network installation image unless a special kernel parameter is added on boot: it will be capable of performing an installation, but it will need to retrieve packages from network repositories, it will not be able to use the packages present on the stick. To allow the installer to find the packages present on the stick, use the [[Anaconda/Options#repo|anaconda ''repo='' parameter]], pointing to the USB stick by its device node, label or UUID. DVD images of {{FedoraVersion|long|17}} do not suffer from this limitation.
: (For versions before Fedora 17, use {{Code|/dev/live}} instead of {{Code|/run/initramfs/livedev}}.)
}}


==== Using the {{command|livecd-iso-to-disk}} tool ====


The {{command|livecd-iso-to-disk}} is the most capable and often most reliable method of writing a Fedora ISO image to a USB stick, but can only reliably be used 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 {{command|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.
The {{command|livecd-iso-to-disk}} is the most capable and often most reliable method of writing a Fedora ISO image to a USB stick, but can only reliably be used 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 {{command|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.
Line 198: Line 136:


Mount the .iso filesystem on your mount point:
Mount the .iso filesystem on your mount point:
  $ su -c "mount Fedora-16-x86_64-Live-Desktop.iso /tmp/live"
  $ su -c "mount Fedora-17-x86_64-Live-Desktop.iso /tmp/live"


Confirm the availability of {{command|/LiveOS/livecd-iso-to-disk}}:
Confirm the availability of {{command|/LiveOS/livecd-iso-to-disk}}:
Line 210: Line 148:
  $ su -c 'yum install livecd-tools'
  $ su -c 'yum install livecd-tools'


Detailed usage information 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#l27 livecd-iso-to-disk script], which you can also see by running {{command|su -c 'livecd-iso-to-disk --help'}}. Basic examples follow.
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 {{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:
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:


If {{command|livecd-iso-to-disk}} is available in the .iso filesystem,
If {{command|livecd-iso-to-disk}} is available in the .iso filesystem,
  $ su -c "/tmp/live/LiveOS/livecd-iso-to-disk Fedora-16-x86_64-Live-Desktop.iso /dev/USBPARTITIONNAME"
  $ su -c "/tmp/live/LiveOS/livecd-iso-to-disk Fedora-17-x86_64-Live-Desktop.iso /dev/sdX"
otherwise,
otherwise,
  $ su -c "livecd-iso-to-disk Fedora-16-x86_64-Live-Desktop.iso /dev/USBPARTITIONNAME"
  $ su -c "livecd-iso-to-disk Fedora-17-x86_64-Live-Desktop.iso /dev/sdX"
(See [[#Data persistence|Data persistence]] below for how to create Live USB devices with more than temporary storage of user files and settings.)
(See [[#Data persistence|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:
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-16-x86_64-Live-Desktop.iso /dev/USBPARTITIONNAME"
  $ su -c "livecd-iso-to-disk --reset-mbr Fedora-17-x86_64-Live-Desktop.iso /dev/sdX"


{{admon/warning | CAUTION | The following method will erase all data on the USB drive!  Please read the instructions below ''carefully''.}}
{{admon/warning | CAUTION | The following method will erase all data on the USB drive!  Please read the instructions below ''carefully''.}}
If necessary, you can have {{command|livecd-iso-to-disk}} re-partition and re-format the target stick. This is similar to performing the manual re-partitioning and re-formatting steps described earlier in this guide. 
If necessary, you can have {{command|livecd-iso-to-disk}} re-partition and re-format the target stick.
  $ su -c "livecd-iso-to-disk --format --msdos --reset-mbr Fedora-16-x86_64-Live-Desktop.iso /dev/USBPARTITIONNAME"
  $ su -c "livecd-iso-to-disk --format --msdos --reset-mbr Fedora-17-x86_64-Live-Desktop.iso /dev/sdX"


=== UEFI boot of USB sticks ===
==== 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 {{command|--efi}} parameter to the {{command|livecd-iso-to-disk}} tool attempts to make a stick written with that tool natively UEFI bootable.
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 {{command|--efi}} parameter to the {{command|livecd-iso-to-disk}} tool attempts to make a stick written with that tool natively UEFI bootable.


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


=== 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 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.
Line 246: Line 184:
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 2047 for VFAT, but for ext[234] filesystems it is only limited by the available space.  
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 2047 for VFAT, but for ext[234] filesystems it is only limited by the available space.  
{{anchor|limited overlay}}
{{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 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.}}
{{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.


See [[#Mounting a Live USB filesystem|this section]] for mounting the root filesystem outside of a boot.
For normal, write-many storage (vs the write-once overlay), use the ''--home-size-mb'' option to create a home directory filesystem for personal files. The 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:
<pre>
<pre>
Line 259: Line 200:
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, DVD, or USB and want to convert that into a bootable USB stick, run the following command:
== Using {{command|liveusb-creator}} ==


su -c "livecd-iso-to-disk /run/initramfs/livedev /dev/USBPARTITIONNAME"
[[Image:Liveusb-creator.png]]


: (For versions before Fedora 17, use {{Code|/dev/live}} instead of {{Code|/run/initramfs/livedev}}.)
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''


== How to Boot a Live USB Drive ==
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 281: Line 226:
** 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.


== Problems and solutions ==
= Troubleshooting =


=== liveusb-creator problems ===
== liveusb-creator problems ==


* Try the [http://fedorahosted.org/liveusb-creator/wiki/FAQ liveusb-creator FAQ].
* Try the [http://fedorahosted.org/liveusb-creator/wiki/FAQ liveusb-creator FAQ].
Line 293: Line 238:
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>
$ su -c "livecd-iso-to-disk Fedora-16-x86_64-Live-Desktop.iso /dev/USBPARTITIONNAME"
$ 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 304: Line 249:
To mark the partition bootable, run parted, and use the 'toggle X boot' command. For example:
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 320: Line 265:
(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 335: Line 280:
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>
$ su -c "livecd-iso-to-disk Fedora-16-x86_64-Live-Desktop.iso /dev/USBPARTITIONNAME"
$ 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 343: Line 288:
To label the partition:
To label the partition:
<pre>
<pre>
su -c "dosfslabel /dev/USBPARTITIONNAME LIVE"
su -c "dosfslabel /dev/sdX LIVE"
</pre>
</pre>


Line 354: Line 299:
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).
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>
$ su -c "livecd-iso-to-disk Fedora-16-x86_64-Live-Desktop.iso /dev/USBPARTITIONNAME"
$ 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 361: Line 306:


To install or reset MBR:
To install or reset MBR:
  $ su -c "livecd-iso-to-disk --reset-mbr Fedora-16-x86_64-Live-Desktop.iso /dev/USBPARTITIONNAME"
  $ su -c "livecd-iso-to-disk --reset-mbr Fedora-17-x86_64-Live-Desktop.iso /dev/sdX"


=== Issues using other Linux distributions ===
== 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.
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 described above.
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.


== Testing Live Image on USB ==
= Testing Live Image on USB =


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


  [[Image:FedoraLiveCD_USBHowTo_usb_flash_with_qemu.png|thumb]]
  [[Image:Screenshot_qemu_gtk3.png‎|thumb]]


For example, if your USB flash drive is {{filename|/dev/sdb}}, you could type the following commands:
For example, you could type the following commands:
<pre>
<pre>
su -c 'umount /dev/sdb1'
su -c 'umount /dev/sdX1'
qemu -hda /dev/sdb -m 1024 -vga std
qemu -hda /dev/sdX -m 1024 -vga std
</pre>
</pre>
== Mounting a Live USB filesystem ==
= 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 {{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.
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 {{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.


== Kernel updates ==
= Kernel updates =


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.
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, [[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>
* '''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>


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.   
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.   
Line 400: Line 345:
  ln -fs -T ../${bootpath}/initrd0.img boot/initramfs-${new}.img
  ln -fs -T ../${bootpath}/initrd0.img boot/initramfs-${new}.img


== 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 06:10, 4 January 2013

本页介绍 如何创建和使用Fedora启动U盘。 你可以使用一个Fedora启动U盘,在不安装Fedora系统到硬盘的情况下启动一台支持U盘启动的电脑。 你可以在启动U盘中划分一块区域存储你对系统的更改(安装软件或者修改配置), 这种模式被称为 持续覆盖.你也可以划分一块单独空间用来存储你的用户账户信息和数据,比如你的文档和下载的文件,当然,为了数据安全你可以选择加密他们。最后,因为安装是非破坏性的,之前的文件和剩余的空间都可以在系统中访问。这相当于你把整个电脑装在口袋里,在你能找到的大部分机器上启动你自己的系统。

现在的Fedora版本中,你也可以把非自生Fedora镜像(DVD和网络安装镜像)写入U盘,有些用户觉得这样更方便,而且比写入光盘更快。

Note.png
Quick start
方法对大多数人都很简单。大多数厂商制造的U盘都适用。如果U盘中有文件,最好先备份一下。

重启电脑使用机器内置的方式选择USB启动设备-- 通常是在启动时按下特定的键, 比如F12。 然后你可以开始试用了!!

如果你想获得技术上的细节,或者想获得更多关于可以选择的工具以及高级用法,读下面的内容。
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.

系统需求

  • 一台使用GNU/Linux, Windows 或者 MacOS的电脑
  • 一个拥有1G以上存储空间的 USB闪存设备, 像U盘、存储卡等。
  • 一个Fedora镜像文件,你可以从http://fedoraproject.org/get-fedora 下载

你的电脑是否允许从USB设备启动

鉴于不同的BIOS的功能有所差别,部分电脑不能USB启动。如果你恰好在此列,考虑其他安装介质(光盘、硬盘等)。如果你不确定是否能够USB启动,又不介意下载并刻录Fedora镜像到你的USB设备(可能会擦除你的数据),不妨一试,最多浪费一点时间

  • U盘自身问题可能导致此过程失败,注意查看错误信息。

GNU/Linux下方法

定位你的U盘

首先找到U盘分区号

  • 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.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. While your results may vary, for best results, use the liveusb-creator. 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.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)

Note.png
Copying from a LiveCD
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.)


The livecd-iso-to-disk is the most capable and often most reliable method of writing a Fedora ISO image to a USB stick, but can only reliably be used 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.

livecd-iso-to-disk is usually available in the /LiveOS directory of the Live CD .iso file. You may loop mount the .iso, and procede as below, assured that you are using the version intended for your image:

Make a mount point:

$ su -c "mkdir /tmp/live"

Mount the .iso filesystem on your mount point:

$ su -c "mount Fedora-17-x86_64-Live-Desktop.iso /tmp/live"

Confirm the availability of /LiveOS/livecd-iso-to-disk:

$ ls /tmp/live/LiveOS

If the livecd-iso-to-disk script is not listed, your will need to obtain it from another source. Check if the livecd-tools RPM is installed with this 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 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:

If livecd-iso-to-disk is available in the .iso filesystem,

$ su -c "/tmp/live/LiveOS/livecd-iso-to-disk Fedora-17-x86_64-Live-Desktop.iso /dev/sdX"

otherwise,

$ 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.png
CAUTION
The following method 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.

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 2047 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 (vs the write-once overlay), use the --home-size-mb option to create a home directory filesystem for personal files. The 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