Rescuing Linux Systems--Generic and Distribution-Specific Safety Nets - page 5
Sending Out an SOS
Though most businesses that depend on Linux tend to run the same distribution on all their machines, there are still good reasons for sticking with vendor-supported distributions even if they're not your favorite Linux. Hardware vendors such as Dell (who actively supports Linux) often provide distributions with enhanced or customized drivers that reflect the hardware that they ship, and may not be able to help you unless you're running their Linux. Similarly, developers may have installed their favorite Linux on their desktops, but still expect you to be able to save them when they've accidentally dd'ed their .bashrc over their hard drive's boot block.
Running multiple Linux distributions in the same machine room or across the desktops in your enterprise sometimes means that you may not be able to quickly put you hands on "the right" set of Linux CDs when a problem occurs - you may have stored them off-site or may simply be drowning in a sea of installation CDs, and a crisis is no time to lament your filing system. Luckily, even if your damaged Linux system runs a different Linux distribution, you can often use the boot CD from one distribution to rescue another, depending on the type of hardware you're using and the filesystems and boot loaders supported by each.
The following sections provide an overview of the rescue modes provides by most of the popular Linux distributions and the tools that each provides to help you get your damaged Linux system up and running again.
Booting from a Debian 2.6 CD created using the jigdo utility provides two rescue mechanisms. You can either boot from the CD and begin an installation that you can escape from in order to repair an existing system, or specify an existing root partition using the root=/dev/whatever option. In the former case, after selecting the language and language variant that you want to use, you can use the arrow keys to select repair/recovery-related commands such as "View the Partition Table", "Execute a Shell", "Make System Bootable" (after root mounted), "Make a Boot Floppy" (after root and swap mounted), and so on. Selecting Execute a Shell" gives you access to fsck for ext2 and ext3 filesystems, the fdisk partitioning utility, and the mkfs utility for ext2 filesystems and mkswap utility to recreate corrupted swap partitions.
Mandrake's traditional user friendliness carries over into the rescue mode provided by their distribution CDs. After booting from the first CD, press F1 for a list of advanced options, type "rescue" at the boot prompt, and press <CR>. After booting, Mandrake's rescue mode displays a menu of choices: "Re-install Boot Loader", "Restore Windows Boot Loader", "Mount your partitions under /mnt", "Go to console", "Reboot", and "Doc: what's addressed by this Rescue?". "Go to console" is the most useful of these choices across a variety of Linux systems, because it simply gives you a root prompt and access to the tools that you can use to repair your system.
Mandrake 8.2's rescue mode provides versions of fsck for the ext2, ext3, JFS, ReiserFS, and XFS filesystems. For true calamities, it also provides the fdisk and sfdisk partitioning utilities, as well as mkfs for ext2 filesystems. If your bootloader is damaged, Mandrake's rescue mode also provides grub-install.
Red Hat 7.3
Red Hat's rescue mode is quite powerful. After booting from CD #1, press F4 for information and type "linux rescue" at the LILO prompt to boot the rescue kernel. You then select the language and keyboard that you want to use, and the rescue mode tries to locate an existing Red Hat root directory and mount it as /mnt/sysimage. You can then press <CR> to log in and get a shell.
Red Hat's rescue mode only includes versions of fsck for ext2, ext3, and ReiserFS filesystems. If a partition is beyond recovery through fsck, Red Hat's rescue mode includes the fdisk and sfdisk partitioning tools, and the commands to create ext2, ext3, RAID, ReiserFS, swap, and even VFAT filesystems. It includes LILO and provides access to grub-install if it has been able to find and mount existing partitions that include this utility.
As one of the longest-lived Linux distributions, Slackware's lack of focus on graphical bells and whistles makes it a good candidate for rescuing any damaged Linux system. After booting from the first install CD, you can either press <CR> to load the standard kernel or press F3 to see a list of bootable kernels with built-in support for specific device subsystems, filesystems, and so on, including SCSI, the XFS filesystem, the JFS filesystem, RAID, USB, and so on.
Once you've booted from one of these kernels, Slackware provides convenient commands for probing and initializing subsystems such as the network, PCMCIA, and so on. It only includes versions of fsck for the ext2 and ext3 filesystem, since recovery of JFS and XFS filesystems should be handled as part of the mount command under a kernel that supports these filesystems. In the catastrophe department, Slackware includes the fdisk and cfdisk partitioning utilities, versions of mkfs for ext2, ext3, JFS, ReiserFS, and XFS filesystems, and also includes the commands to create RAID devices and the physical volumes used by LVM. Slackware's rescue mode does not include LILO or grub-install.
As you might expect from the world's largest, most-frequently-updated Linux distribution, SuSE install CDs provide a rescue mode that gives you more tools than you can shake an operator at. To boot SuSE 8.0 in rescue mode, boot from CD #1 or the DVD, use the arrow keys to select "Rescue System" from the initial menu and press <CR>. The rescue kernel boots, prompts you to select a keyboard map, and gives you a root prompt.
SuSE 8.0's rescue mode provides versions of fsck for the ext2, ext3, jfs, ReiserFS, and XFS filesystems, as well as additional tools for repairing ReiserFS and XFS filesystems, LVM (logical volume management), and RAID support. For worst-case partition damage scenarios, it provides fdisk and versions of mkfs for all of these types of filesystems. It also includes LILO if you need to rewrite the boot block on your primary disk.