Sonora Communications, Inc.

  • Increase font size
  • Default font size
  • Decrease font size

Master Boot Record Recovery

E-mail Print PDF

Sometimes the Master Boot Record (MBR) of a hard drive will be damaged or overwritten and the computer will not boot properly until it is fixed. This can happen when you (re)install Windows on a multi-boot system. The Windows installation procedure overwrites the MBR without warning.

DOS/Windows

Run this command:

fdisk /mbr

Linux

In DOS/Windows systems, the MBR is generally quite simple and just points the boot process to the first partition flagged as 'bootable'. Linux systems generally use the lilo or grub boot loaders and use the MBR to provide a more sophisticated boot menu.

If you just want to install a simple DOS-style MBR, such as for a FAT-formatted flash drive, here is a good tool in Ubuntu:

sudo fdisk -l
sudo install-mbr /dev/sdx

The repair procedures for GRUB and LILO are similar, but the final commands differ. If logical volume management is in use (LVM), modify as necessary.

Boot the computer with a bootable Linux CD. Any live-CD or most installation CDs will work.

Open a terminal window.

Mount the hard drive in a writable mode. You may have to unmount, then remount to achieve the desired results. We'll use /dev/sdb in this example which is the second SATA, USB or SCSI drive in a system. Adjust as necessary for your configuration (ex: /dev/hdb for the second IDE drive).

mount -rw /dev/hda1 /mnt/hda1

Change the root to the partition containing the root filesystem (typically /dev/sda1 on Suse Linux).

chroot /mnt/sda1

Lilo Boot Loader

Write the new MBR to the disk using lilo.

lilo -v

Grub Boot Loader

Write the new MBR to the disk using grub.

grub-install /dev/sda
Last Updated on Thursday, 07 May 2009 15:41  

Your external IP

You are connecting to this site from: 38.107.179.240

Secure Client Login

Email Address:

Password: