How to create and use Live USB/bg
На тази страница е обяснено как да направите и използвате жива USB медия. Жива система, записана на USB флаш памет, често наричана флашка, Ви позволява да стартирате операционната система Fedora на който и да е компютър, способен да зареди система от USB без да записвате нищо на твърдия диск на компютъра. USB флашката със жива система може да предоставя област за записване на промени в системата, наречена постоянна част. Флашката може да има също и част за съхранение на информация за потребителските акаунти и данни като документи и свалени файлове, евентуално защитени чрез криптиране с цел сигурност и спокоен сън. Накрая, всички файлове, тези от постоянната част, предварително записаните, документите и свободното пространство за съхранение на данни са достъпни от системата. Така Вие можете да носите в джоба си собствения си компютър, да го зареждате на почти всяка система, която решите, че може да използвате.
Изисквания към системата
- Работещ компютър с Fedora или Windows. Ако използвате друга Линукс дистрибуция, можете да използвате dd или UNetbootin. UNetbootin можете да използвате също и с Mac OS X и Windows, а освен това е наличен и в хранилищата на Fedora.
- USB флаш паметта, наричана още USB stick, thumb drive, pen drive, или jump drive, с 1 GB или повече обем за съхранение на данни, с файлова система vfat (стандартно за почти всички външни USB памети)
Способност за зареждане от USB медия
Въпреки че почти всички модерни компютри имат тази възможност, все още не всички могат да зареждат от USB медия, поради различните BIOS настройки и функционалности. Ако Вашият компютър няма такава възможност, тази процедура е неизползваема. Ако не сте сигурни и не Ви притеснява свалянето и инсталирането на образ на Вашата USB памет (с вероятно изтриване на данните в нея), единственото, което рискувате да загубите, е малко време.
Ако Вашата USB памет е повредена, тази процедура може да се провали. Следете съобщенията за грешки по време на процеса.
Някои флаш памети по подразбиране може да не са зареждащи, въпреки че хардуерът Ви е способен на това. Може да се наложи да маркирате дял като зареждащ (активен) или да се наложи да форматирате флашката отново. Вижте Грешки и решения по-долу за повече информация.
Проверка големината на Вашата USB памет
Обемът на много USB флашки е написан на корпуса или на опаковката им.
Ако не знаете обема на флашката, или искате да я проверите за наличието на данни, включете я в компютъра и би трябвало тя автоматично да се появи като устройство. Можете да проверите обема и като използвате графичния файлов мениджър. В Линукс, Вие може да използвате в терминал командата:
$ df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 143G 14G 122G 10% / /dev/sda1 99M 12M 82M 13% /boot tmpfs 1009M 0 1009M 0% /dev/shm /dev/sdb1 3.9G 4.0K 3.9G 1% /media/usbdisk
USB устройствата обикновено се монтират в директория /media. В този случай, устройството е /dev/sdb1, има обем 3.9GB и почти целият обем е свободен (1% е зает).
Запомнете това "/dev/sdb1" или подобното във Вашия случай. Ще трябва да го задавате като име на устройството, ако използвате метода с команди в терминал.
How to Partition
If the drive has not been partitioned properly (or if you are unsure), use
fdisk to repartition it.
It is also possible to do a non-destructive installation of a LiveUSB image, if you have sufficient empty space. See How to install non-destructively below.
fdisk command must be run as root. Include only the drive name in the command, not the partition number. Be sure to select the correct disk, or you may erase important data! Check the output of "df -h" if you are unsure. For example, if your partition will be /dev/sdb1, do:
$ /sbin/fdisk /dev/sdb
If you don't have fdisk installed, run
yum install util-linux-ng as root.
The following session output from
fdisk shows the responses to give to the prompts. The line starting
Last cylinder ... refers to the size of the flash drive, so may be different than in the example.
Command (m for help): d Selected partition 1 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-960, default 1): ↵ Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-960, default 960): ↵ Using default value 960 Command (m for help): t Selected partition 1 Hex code (type L to list codes): 6 Changed system type of partition 1 to 6 (FAT16) Command (m for help): a Partition number (1-4): 1 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: If you have created or modified any DOS 6.x partitions, please see the fdisk manual page for additional information. Syncing disks.
How to Format
If your USB media has sufficient free space on a vfat file system already, you do not need to perform this step.
To finish, the partition must be formatted with an actual file system using
mkdosfs as the root user. Unmount the device before using
mkdosfs. In the below example, /dev/USBPARTITIONNAME might be, for example, /dev/sdb1. Be sure to select the correct partition; formatting destroys all data on it!
$ umount /dev/USBPARTITIONNAME $ /sbin/mkdosfs -F 32 -n usbdisk /dev/USBPARTITIONNAME
If you don't have mkdosfs installed, run "yum install dosfstools" as root.
How to install non-destructively
Skip the repartitioning and formatting step above, and simply continue with the below steps. Please keep in mind you should have at least 1GB free. It is highly recommended to make a backup copy of the data on the USB drive before proceeding in case something goes wrong.
From a Downloaded Image
Download an ISO
(If you are using liveusb-creator - the "Graphical" method below, with a "supported" Fedora release, you can skip this step. The program will download the ISO for you.)
You can use BitTorrent or your web browser to download a bootable image, or ISO, which you will install on your USB drive.
- Supported releases
- Pre-releases (Alpha and Beta; redirects to previous supported release during pre-Alpha phase)
- Rawhide daily build
You are looking for a file with "Live" in the name, usually of the form "F<version>-<architecture>-Live.iso". For example, "F12-i686-Live.iso" is the Fedora 12 release for 32-bit Pentium Pro and compatible CPUs. "F13-Alpha-x86_64-Live.iso" is the alpha pre-release version of Fedora 13 for 64-bit Intel-compatible CPUs. Be sure to choose the correct file for your architecture. 32-bit releases will generally run on 64-bit hardware, but will not be optimized.
These instructions will also work for Custom Spins of Fedora Live ISO images, including those you make yourself with Revisor (a graphical tool), or LiveCD Creator (command-line tool used by Revisor). (Pungi is a command-line tool you can use to create installable ISOs, but not Live ISOs.)
If you use a LiveUSB with data persistence, you can use the "yum update" method described below to get the latest daily Rawhide RPMs (mostly for testers and not everyday use) except for the kernel. See Releases/Rawhide for more information about daily builds.
Live ISOs are not made daily for Branched, Alpha, Beta, and Final phases, only at the Alpha, Beta, and Final milestones.
Graphical Method - Windows or Fedora
Fedora LiveUSB sticks can be created in Windows and Linux using the liveusb-creator.
For Windows using the following steps:
- Download liveusb-creator from http://fedorahosted.org/liveusb-creator
- Double click 'liveusb-creator'
If you are using Fedora, you can use Add/Remove Programs and search for liveusb-creator or on the command line:
$ su -c "yum install liveusb-creator"
To start, run
liveusb-creator on the command line, or on the GNOME menu, go to "Applications -> System Tools -> liveusb-creator".
If you are using an older version of Fedora (9 or 10), you may need to work around bug 494000.
Command Line Method - Linux only
In the following examples, replace "/path/to/ISO" with e.g. F12-Live-i686.iso or the full path to the ISO you downloaded, e.g. /tmp/F12-Live-i686.iso.
Replace /dev/USBPARTITIONNAME with the appropriate partition name. For example, /dev/sdb1 in the example above ("Check the size of your USB drive"). Be careful to specify the correct device, or you may lose important data!
The livecd-iso-to-disk method also works with DVD install iso images, even though these are not Live images.
Using dd for a direct copy
Fedora 12 and above, you can simply use dd although the specialized tools have additional features like non destructive writing and data persistence. Fedora 12 to Fedora 15 this method will only work for liveCD iso's and NOT install media. With Fedora 16, install media will work fine as well.
$ sudo dd if=F12-Live-i686.iso of=/dev/sdX bs=8M
Note that you want the device name (e.g. /dev/sdx) not the partition name (e.g. /dev/sdx1).
This method also works with netinst.iso and boot.iso images. In Fedora 13, ":/images/install.img" has to be appended to boot parameter stage2=hd:label="Fedora" (you can do it after hitting Tab in boot selection screen) to prevent asking for install.img location in loader text UI. This should be fixed with bug 528809
Make sure the livecd-tools RPM is installed.
$ rpm -q livecd-tools
You will see the name of the RPM and a version number if it is installed, and no output if it is not installed.
If "livecd-tools" is not installed, install it using yum.
$ su -c "yum install livecd-tools"
Run livecd-iso-to-disk script
Script usage is available in the first pages of the livecd-iso-to-disk script.
Make sure that the USB drive is not mounted before executing the following, and give the root password when prompted.
$ su -c "livecd-iso-to-disk /path/to/ISO /dev/USBPARTITIONNAME" Password: Copying live image to USB stick Updating boot config file Installing boot loader USB stick set up as live image!
In case it is not possible to boot from a disk created with the method shown above, you can also tell livecd to format the medium itself. Note that this method causes livecd to format the disk and thus erase all the data on it:
$ su -c "livecd-iso-to-disk --format --reset-mbr /path/to/ISO /dev/USBPARTITIONNAME"
Data persistence means that your files and settings will remain even after you reboot your live system. You can perform updates just like a regular installation to your hard disk except for kernel updates which are not supported. The primary use of this feature is booting a USB stick with your live image as well as the persistent changes.
Use liveusb-creator, a graphical utility to do this easily. Liveusb-creator is available in the Fedora repository and for Windows users as well.
If you prefer the command line, you can run the following command:
$ sudo livecd-iso-to-disk --overlay-size-mb 512 /path/to/ISO /dev/USBPARTITIONNAME
where 512 is the desired size (in megabytes) of the overlay. The livecd-iso-to-disk shell script won't accept an overlay size value greater than 2047 for VFAT, but for ext filesystems it is only limited by the available space. You can find the livecd-iso-to-disk shell script in the LiveOS directory at the top-level of the CD image. Note that you'll need to have space on your USB stick for the live image plus your overlay plus any other data you want on the stick.
The persistent overlay status may be queried by issuing this command on the live system:
dmsetup status live-rw
The returned value may look like this:
live-rw: 0 8388608 snapshot 42296/204800 176
where the fraction after 'snapshot' for the logical volume is that of 512-byte sectors consumed in the overlay.
From a running Live CD/DVD/USB
If you are already running a live CD or DVD and want to convert that into a bootable USB stick, run the following command as a root user:
# livecd-iso-to-disk /dev/sr0 /dev/USBPARTITIONNAME
From a running Live USB, use /dev/live as the source:
# livecd-iso-to-disk /dev/live /dev/USBPARTITIONNAME
How to Boot a Live USB Drive
- Power off the computer.
- Plug the USB drive into a USB port.
- Remove all other portable media, such as CD, DVD, or floppy disks.
- Power on the computer.
- If the computer is configured to automatically boot off of the USB drive, you will see a screen that says "Automatic boot in 10 seconds..." with a countdown.
- If the computer starts to boot off the hard drive, you'll need to manually configure it to boot off the USB drive.
- Wait for a safe point to reboot safely.
- As the machine starts to reboot, watch carefully for instructions on which key to press (usually a function key or Escape) to enter the boot device selection menu, or "BIOS setup". Press and hold that key. If you miss the window of opportunity (often only a few seconds) then reboot and try again.
- Use the BIOS setup menu to put your USB drive first in the boot sequence. It might be listed as a hard drive rather than a removable drive. Each hardware manufacturer has a slightly different method for doing so. Use caution! Your computer could become unbootable or lose functionality if you change any other settings. Though these settings can be reverted, you'll need to remember what you changed in order to do so.
- Save the changes, exit, and the computer should boot the Live USB drive.
How to Make a bootable USB Drive to Install Fedora instead of using a physical DVD
Why would I want to make a USB device installer from the DVD instead of the LiveCD?
If you are installing to a netbook, or otherwise do not have an optical drive (or burner, or media), and you want the extra flexibility of using the regular DVD installer instead of the Live image, then this method will give a useful install medium. You are then free to customize package selection, choose which filesystem you prefer for your rootfs (ext3 OR ext4, btrfs, etc), and rescue mode is available.
Preparing the USB stick
The easiest setup method is to install Fedora's own livecd-iso-to-disk script from livecd-tools. Note that the liveusb-creator GUI, however, does not support putting the DVD installer on USB. (Unetbootin has worked in the past as well, but does not currently work for Fedora 14 and 15.)
The manual setup method follows:
First, download the iso file Fedora-15-i386-DVD.iso from a Fedora mirror. This method also works for the boot and netinstall iso's.
Then, from your running 20 system (including an 20 livecd) make sure you have the livecd-tools package installed by doing:
yum install livecd-tools
Use the "mount" command to find the USB stick (e.g., /dev/sdb1) or look at /var/log/messages 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/sdb1
Now as root run:
# livecd-iso-to-disk path-to/Fedora-15-i386-DVD.iso /dev/sdb1
If the stick is not bootable, then refer to the information below to make it bootable, otherwise this command will fail.
You should now have a bootable USB stick which will run an 20 install. When you boot the stick, you may also add askmethod to the boot line and select a hard drive install and select the drive as /dev/sdb1 (or your USB device drive) and the path should be /
The remainder of the install should be the same as for using a DVD in an optical drive, but when you select options make sure that you select your disk partitioning carefully if you are doing custom partitioning and also make sure that the bootloader is installed on the correct drive - by default it will be installed on the USB stick so you will need to change it to the master boot record on the hard drive.
Грешки и решения
- Try the liveusb-creator FAQ.
- Bugs are tracked in Trac - see e.g. existing tickets. Please open a new ticket if you encounter any problems that have not already been reported.
- The liveusb-creator mailing list has archives which may also be useful.
Partition isn't marked bootable!
If you get the following message, you need to mark the partition bootable.
$ livecd-iso-to-disk Fedora-<release>-Live-i686.iso /dev/sdb1 Partition isn't marked bootable! You can mark the partition as bootable with $ /sbin/parted /dev/sdb (parted) toggle N boot (parted) quit Cleaning up to exit...
To mark the partition bootable,
$ parted /dev/sdb GNU Parted 1.8.6 Using /dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print Model: Imation Flash Drive (scsi) Disk /dev/sdb: 1062MB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 1 32.3kB 1062MB 1062MB primary fat16 (parted) toggle 1 boot (parted) print Model: Imation Flash Drive (scsi) Disk /dev/sdb: 1062MB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 1 32.3kB 1062MB 1062MB primary fat16 boot (parted) quit Information: Don't forget to update /etc/fstab, if necessary.
Partitions need a filesystem label!
If you get the following message, you need to label the partition.
$ livecd-iso-to-disk Fedora-<release>-Live-i686.iso /dev/sdb1 Need to have a filesystem label or UUID for your USB device Label can be set with /sbin/dosfslabel Cleaning up to exit...
To label the partition.
$ dosfslabel /dev/sdb1 usbdisk
Partition has different physical/logical endings!
If you get the following message, you may need to reformat the flash drive.
$ fdisk -l /dev/sdb Disk /dev/sdb: 2029 MB, 2029518848 bytes 129 heads, 32 sectors/track, 960 cylinders Units = cylinders of 4128 * 512 = 2113536 bytes Device Boot Start End Blocks Id System /dev/sdb1 * 1 961 1981936 6 FAT16 Partition 1 has different physical/logical endings: phys=(967, 128, 32) logical=(960, 31, 32)
MBR appears to be blank!
If your test boot reports a corrupted boot sector, or you get the following message, you need to install MBR.
$ livecd-iso-to-disk Fedora-<release>-Live-i686.iso /dev/sdb1 MBR appears to be blank. You can add an MBR to this device with Cleaning up to exit...
To install MBR,
$ cat /usr/share/syslinux/mbr.bin > /dev/sdb
SYSLINUX Boot Error!
If you were using the script on previous Red Hat or Fedora Release and getting following error message,
SYSLINUX 3.xx ... EBIOS Load error - Boot error
You may need to upgrade your syslinux to 3.50 or higher from Peter Anvin's SYSLINUX .
Ubuntu and derivative Linux distributions have a usb-creator program similar to Live USB Creator. This does not work with Fedora .iso images, it silently rejects them. (usb-creator requires the .iso has a Debian layout, with a /.disk/info file and a casper directory.)
The livecd-iso-to-disk script isn't meant to be run from a non-Fedora system. Testers have reported that even though it runs in an Ubuntu 10.10 terminal and may complete successfully, the resulting USB flash drive does not boot (RHBZ #699554).
Expert users may be able to use dd to write the Fedora .iso to the USB flash drive (thereby overwriting its partition information and all files on it). Another workaround is to burn the Fedora .iso to a CD-R, boot from this, and then run Live USB Creator or livecd-iso-to-disk from the Fedora environment.
Testing Live Image on USB
You can test your Live Image on USB using QEMU as shown in the screenshot below.
For example, if your USB flash drive is on /dev/sdb1, you could type following command:
$ umount /dev/sdb1 $ qemu -hda /dev/sdb -m 256 -vga std