Книга: Fedora™ Unleashed, 2008 edition
Using the Recovery Facility from the Installation Disc
Разделы на этой странице:
Using the Recovery Facility from the Installation Disc
Rescue mode runs a version of Fedora from the DVD that is independent of your system and permits you to mount your root partition for maintenance. This alternative is useful when your root partition is no longer bootable because something has gone wrong. Fedora is constantly improving the features of the Recovery Facility.
On beginning the rescue mode, you get your choice of language and keyboard layouts. You are given an opportunity to configure networking in rescue mode and are presented with a nice ncurses-based
form to fill in the information. The application attempts to find your existing partitions and offers you a choice of mounting them read-write, read only (always a wise choice the first time), or skip any mounting and drop to a command prompt. With multiple partitions, you must then indicate which is the root partition. That partition is then mounted at /mnt/sysimage. When you are finally presented with a command prompt, it is then possible to make your system the root file system with the following:
# chroot /mnt/sysimage
To get back to the rescue file system, type exit
at the prompt. To reboot, type exit
at the rescue system's prompt.
The rescue function does offer support for software RAID arrays (RAID 0, 1, and 5), as well as IDE or SCSI partitions formatted as ext2/3. After the recovery facility asks for input if it is unsure how to proceed, you eventually arrive at a command shell as root; there is no login or password. Depending on your configuration, you might or might not see prompts for additional information. If you get lost or confused, you can always reboot. (It helps to practice the use of the rescue mode.)
In rescue mode, a number of command-line tools are available for you, but no GUI tools are provided. For networking, you have the ifconfig
, route
, rcp
, rlogin
, rsh
, and ftp
commands. For archiving (and restoring archives), gzip
, gunzip
, dd
, zcat,
and md5sum
commands are there. As for editors, vi is emulated by BusyBox, and pico
, jmacs
, and joe
are provided by the joe
editor. There are other useful system commands. A closer look at these commands reveals that they are all links to a program called BusyBox (home page at http://www.busybox.net/).
BusyBox provides a reasonably complete POSIX environment for any small or embedded system. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the included options "provide the expected functionality and behave very much like their GNU counterparts." This means that you should test the rescue mode first to see whether it can restore your data and check which options are available to you because the BusyBox version will behave slightly differently than the full GNU version. (Some options are missing; some options do not work quite the same — you need to know whether this will affect you before you are in an emergency situation.)
There are a few useful tricks to know when using rescue mode. If your system is functional, you can use the chroot
command to change the root file system from the CD to your system in this manner:
# chroot /mnt/sysimage
You will find yourself at a new command prompt with all your old files in — you hope — the right place. Your familiar tools — if intact — should be available to you. To exit the chroot
ed environment, use the exit
command to return to the rescue system prompt. If you use the exit
command again, the system reboots.
The rescue environment provides a nice set of networking commands and network-enabled tools such as scp
, sftp
, and some of the rtools.
It also provides rpm, which can fetch packages over a network connection. Installing them is tricky because you want them installed in the file system mounted at /mnt/sysimage
, not at /
. To accomplish that, use the --root
argument to set an alternative path to root:
# rpm -ivh --root /mnt/sysimage ftp://location/package.rpm
Alternatives to the Fedora Rescue Disc
The Fedora rescue disc might be inadequate for your system restoration needs; it might lack specific ethernet device support, file system support, or the kind of full utility functionality that you require for a successful recovery operation. An alternative exists in the SuperRescue CD created by H. Peter Anvin.
Essentially, the SuperRescue CD is a reasonably full and robust Red Hat distribution (based on Red Hat 7.2 and the 2.4.20-rc1
kernel) that runs completely from a bootable CD. The best thing about the SuperRescue CD is that it comes with build scripts, so it is incredibly easy to add new software (that special driver or application) and create a new CD. The home page is at http://freshmeat.net/projects/superrescue/, but you can grab a copy directly at http://www.kernel.org/pub/dist/superrescue/v2/.
Relevant Fedora Commands
The following commands are useful in performing backup, recovery, and restore operations in Fedora:
? amdump
— Amanda is a network-based backup system, consisting of 18 separate commands, for use with Linux.
? ark
— A KDE desktop GUI archiving utility.
? cp
— The copy command.
? scp
— The secure shell copy command.
? cpio
— A data archive utility.
? dd
— A data copy and conversion utility.
? gzip
— The GNU compression utility.
? tar
— The GNU tape archive utility.
- The Fedora Rescue Disc
- Booting the System from the Rescue Disc
- Инструкция INSERT INTO ... FROM ... UNION ...
- 4.4.4 The Dispatcher
- Open Source Insight and Discussion
- About the author
- Chapter 7. The state machine
- Appendix E. Other resources and links
- Caveats using NAT
- Example NAT machine in theory
- Using Double Quotes to Resolve Variables in Strings with Embedded Spaces
- The final stage of our NAT machine