Operations 9 min read

Using a Rescue Disk Set to Recover and Repair a Linux System

This guide explains how to employ a boot/root rescue disk set to mount a damaged Linux filesystem, run e2fsck with backup superblocks, recover lost files, fix broken libraries, reset the root password, and restore the bootloader using LILO or loadlin.

ITPUB
ITPUB
ITPUB
Using a Rescue Disk Set to Recover and Repair a Linux System

What Is a Rescue Disk Set?

A rescue disk set (also called a boot/root disk set) provides an independent bootable environment containing a complete Linux system on the second disk and a bootable kernel on the first. System administrators use it to start a Linux system in emergency mode and perform maintenance tasks.

Mounting the Hard‑Disk Filesystem

After booting from the two rescue disks, you are logged in as root. To access files on the hard drive, manually mount its filesystem. For example, to mount an ext2 partition located on /dev/hda2 to /mnt: # mount -t ext2 /dev/hda2 /mnt Once mounted, the original root directory of the hard‑disk becomes /mnt, so a file such as /etc/passwd on the hard drive is accessed via /mnt/etc/passwd.

Repairing a Corrupted Filesystem

If the filesystem is damaged and uses the ext2 type, you can run e2fsck from a floppy or the rescue environment to fix it. For other filesystem types, use the appropriate fsck utility.

When checking from a floppy, avoid mounting the filesystem first.

Common corruption occurs when the superblock is damaged. The ext2 filesystem stores backup copies of the superblock in each block group. To tell e2fsck to use a backup superblock, run: # e2fsck -b 8193 /dev/hda2 The -b 8193 option points to the backup located at block 8193.

Recovering Deleted Files

If an important file was accidentally deleted, you cannot directly restore it, but you can copy it from the rescue disk to the hard‑disk after mounting. For example, to restore /bin/login: # cp -a /bin/login /mnt/bin The -a flag preserves permissions. This works only if the needed file exists on the rescue disk; otherwise you must rely on a prior backup.

Fixing a Broken Library Directory

Damage to system libraries or broken symbolic links in /lib prevents commands that depend on those libraries from running. The simplest fix is to boot with the rescue disk, mount the hard‑disk to /mnt, and replace or repair the libraries under /mnt/lib.

Resetting a Lost Root Password

If the root password is forgotten or has been changed by an attacker, you can reset it using the rescue disk. After mounting the hard‑disk, edit /mnt/etc/passwd (or /mnt/etc/shadow if shadow passwords are used) and clear the encrypted password field for the root entry: root::0:0:root:/root:/bin/bash After rebooting, you can log in as root without a password and immediately set a new one with passwd.

Restoring the Bootloader

If the master boot record (MBR) was overwritten (e.g., by reinstalling another OS), the Linux bootloader (LILO) must be rewritten. With the rescue disk mounted, run the LILO command to reinstall the bootloader to the MBR.

When no rescue disk is available, you can still boot Linux using loadlin from DOS. You need the Linux kernel image (e.g., vmlinuz) and the root partition device. Example command: # loadlin vmlinuz root=/dev/hda8 This loads the kernel directly, after which you can log in as root and run LILO to restore the normal boot process.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

bootloaderRoot PasswordFilesystem RepairRescue Disk
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.