Rescue mode is a term used to describe a method of booting a small Linux environment completely from diskettes.
What follows in this section may help you recover from a problem at some point. A copy of these instructions is also available as rescue.txt on your Red Hat Linux 6.0 CD-ROM.
As the name implies, rescue mode is there to rescue you from something. In normal operation, your Red Hat Linux system uses files located on your system's hard drive to do everything -- run programs, store your files, and more.
However, there may be times when you are unable to get Linux running completely enough to access its files on your system's hard drive. By using rescue mode, it's possible to access the files stored on your system's hard drive, even if you can't actually run Linux from that hard drive.
Normally, you'll need to get into rescue mode for one of two reasons:
You are unable to boot Linux, and you'd like to fix it. You are having hardware or software problems, and you want to get a few important files off your system's hard drive.
Let's take a closer look at each these scenarios.
What do you need to get into rescue mode?
To get into rescue mode, you'll need a rescue disk set. These are two diskettes that contain the files necessary to boot into rescue mode.
If you elected to make a boot diskette while you were installing Red Hat Linux, you're halfway there! The first diskette in a rescue disk set is this boot diskette.
Now on to the second diskette...
The second diskette is called the rescue diskette. It is produced by writing an image file onto a diskette. The image file is called rescue.img, and is located in the images directory on the first Red Hat Linux CD-ROM.
To gain access to this file, you'll first need to mount your Red Hat Linux CD-ROM.
Start by inserting the CD-ROM in your system's CD-ROM drive. You'll need to do this while logged in as root.
Type the following command:
mount /dev/cdrom /mnt/cdrom
You may get an error message from the first command saying that the file exists. That's fine; we just want to make sure that there is a /mnt/cdrom directory on your system. The second command should issue an informational message that /dev/cdrom is being mounted read-only.
Please Note: Some systems may not recognize /dev/cdrom. If this is your case, you'll have to replace /dev/cdrom in the command with the appropriate device name for your CD-ROM.
Next, issue the following command (again, while logged in as root):
to list the contents of the images directory.
You should see a file named rescue.img. This is the rescue diskette image file. Next, put a diskette in your first diskette drive, and enter the following command:
dd if=rescue.img of=/dev/fd0 bs=1440k
Your system's diskette drive should start writing to the diskette. After a minute or so, the dd command will complete, and you'll get your shell prompt back.
Wait for your diskette drive's access light to go out, and that's it!
You now have a rescue disk set. Label this diskette something like ``Red Hat Linux 6.0 rescue diskette'' and store it someplace safe.
Let's hope you never have to use it.
If you should ever need to use rescue mode, here's how.
Boot your system with the boot diskette in the first diskette drive. At the LILO Boot: prompt, enter the word rescue. You will see the usual kernel messages as the Linux kernel starts up.
Eventually, it will ask you to insert the next diskette, and press [Enter]. Remove the boot diskette, insert the rescue diskette, and press [Enter].
The rescue diskette will be read into memory. After a minute or so, you should see the shell prompt. That's it -- you're in rescue mode!
When it comes to rescue mode, that's a bit like asking, ``how long is a piece of string?'' What you require depends a great deal on what your system's problem is, your level of Linux expertise, and several variables we haven't even thought of yet. So we can't give you explicit instructions.
But we can tell you what programs you have access to while in rescue mode.
Here's the list:
badblocks bash bzip2 cat chmod chroot cp cpio dd e2fsck fdisk grep gunzip gzip head ifconfig init ln ls lsmod mkdir mke2fs mknod mount mt mv open pico ping ps restore rm route rpm sed sh swapoff swapon sync tac tail tar traceroute umount vi vim
You're likely to be unfamiliar with most, if not all of these commands. However, the commands do have man pages. Once you begin to feel more comfortable with commands, you should consider familiarizing yourself them through the man pages. (You may not have that luxury if you have to use these commands...)
You've worked with some pretty useful commands for your Red Hat Linux system so far. You may not have known much about where those files were in the directory, however.
For more information about the Linux filesystem, including navigation and working with other useful commands to help you understand your system, turn to the next chapter.