Booting Red Hat Linux into rescue mode.

January 28, 2011
By

Red Hat Linux can be booted into rescue mode from the installation CD, or any other boot method instead of the system’s hard drive. This also applies to other versions of Linux such as Fedora and Centos.

The rescue mode is provided for troubleshooting and repair purposes. This is really handy when the OS is broken and you are unable to access the system drive. Using rescue mode you can access the files stored on the system’s hard drive.

Boot the system from the installation CD-ROM, or you cab also use the iso file in the case of Vmware. When presented with the boot: prompt, type the following command:
linux rescue.


You are prompted to answer a few basic questions, such as language to use, and keyboard type. Select do not start network interface, unless you have a reason to.

When prompted with the message “The rescue environment will attempt to find the Linux installation and mount it under the directory /mnt/sysimage…..”, select continue. You should then see a message “Your system had been mounted under /mnt/sysimage…”. Select OK, you are now is single-user mode.

The default root partition while in rescue mode is a temporary root partition, not the root partition of the file system used during normal user mode (runlevel 3 or 5). If you selected to mount your file system and it mounted successfully, you can change the root partition of the rescue mode environment to the root partition of your file system by executing the following command:
Chroot /mnt/sysimage

This is useful if you need to run commands such as rpm that require your root partition to be mounted as /. To exit the chroot environment, type exit, and you will return to the prompt.

You can also mount a partition manually inside rescue mode by creating a directory such as /foo, and typing the following command:
mount -t ext3 /dev/hda5 /foo
In the above command, /foo is a directory that you have created and /dev/hda5 is the partition you want to mount. If the partition is of type ext2, replace ext3 with ext2.

If you do not know the names of your partitions, use the following command to list them:
fdisk –l

From the prompt, you can run many useful commands such as
list-harddrives to list the hard drives in the system
ssh, scp, and ping if the network is started
dump and restore for users with tape drives
parted and fdisk for managing partitions
rpm for installing or upgrading software
joe for editing configuration files (If you try to start other popular editors such as emacs, pico, or vi, the joe editor will be started.)

Be Sociable, Share!

Tags: , , ,

Leave a Reply