Home Welcome 3.226.243.130 - Suggested View 1024x768 - Last Update 19/04/2005 Back Forward



LILO, MBR and EXT2





In this section will be shown how to restore a Linux system with the MBR and/or filesystem corrupted. The first thing you need is a working Linux kernel to boot; you can try to use, for example, your Linux distribution's CD or a specific recovery system like Picoboot, a mini Linux distribution that cover only one floppy disk and is rich of useful tools. It can be downloaded here.


These are the steps to follow after you have boot Linux with the system you prefer:

REINSTALLING LILO WITH THE ORIGINAL SYSTEM'S CONFIGURATION:

  1. Mount the Linux root partition: mount /dev/hda6 /mnt/linux
  2. Reinstall LILO using the /etc/lilo.conf file: chroot /mnt/linux lilo -v

MAKING A BACKUP COPY OF THE WHOLE CURRENT MBR ON A FLOPPY DISK:

  1. Mount the floppy disk on drive A: mount /dev/fd0 /mnt/floppy
  2. Copy the MBR to the floppy: dd if=/dev/hda of=/mnt/floppy/mbr bs=512 count=1
  3. Unmount the floppy when done: umount /mnt/floppy

RESTORING THE WHOLE MBR FROM FLOPPY DISK:

  1. Mount the floppy disk on drive A: mount /dev/fd0 /mnt/floppy
  2. Copy the MBR on the hard disk: dd if=/mnt/floppy/mbr of=/dev/hda bs=512 count=1
  3. Unmount the floppy when done: umount /mnt/floppy

RESTORING THE BOOT SECTOR, LEAVING PARTITION TABLE UNCHANGED:

  1. Mount the floppy disk on drive A: mount /dev/fd0 /mnt/floppy
  2. Copy only the boot sector on the hard disk: dd if=/mnt/floppy/mbr of=/dev/hda bs=446 count=1
  3. Unmount the floppy when done: umount /mnt/floppy

REPAIRING AN EXT2/3 FILESYSTEM OR A SUPERBLOCK CORRUPTED:

  1. Avoid to mount the corrupted device
  2. Repair the device with: e2fsck -py /dev/hda6
    (with parameter -py at any questions will be ansewered "yes" automatically)
  3. If you need, repair the superblock: mke2fs -n /dev/hda6
    (warning: don't forget the -n parameter otherwise you make a disaster!)
  4. Now look to the output line "Superblock backups stored on blocks" and use the numbers
    shown like input for the next command: e2fsck -py -b number /dev/hda6

Please note that devices and mount points names (/dev/hdax e /mnt/xxxx) are depending by your system configuration, so verify them before starting any of the above operations.






Anti-Spam button. Before you click, please write down my e-mail address. Thanks!