Monday, June 23, 2008

Solved: Restoring the Master Boot Record (MBR) to the boot drive

Context: Missing or corrupted Master Boot Record (or MBR) can and usually will prevent booting a computer.


Problem: Having botched a Linux installation, the Master Boot Record (MBR) was destroyed. To recover and boot the computer again, the MBR must be restored to work order.


Constraints:
  1. No floppy drive
  2. BIOS doesn't support USB booting
  3. CD ROM limited on ability to read different CDs
  4. Windows booted from the MBR directly so I could not use Microsoft's fdisk
  5. Lilo was not found on the Fedora 9 Live CD
  6. Grub-install on the Fedora 9 Live CD did not function according to expectation

Details: Installing Fedora 9 Live CD to an Dell Latitude C600, I didn't allow enough room for the Live CD install (I misremembered options for a selective install.) Additionally, a previous GRUB installation on the Master Boot Record was not clean off before installation started. Near the end of the installation, an error occurred (out of space.) The result was a damaged MBR record. The exact cause of the damage was not known.


Solution: Restore MBR from

  1. Boot Fedora 9 Live CD
  2. Confirm presents of file usr/lib/syslinux/mbr.bin
  3. Open a Xterm or other shell
  4. Log in as root or superuser
  5. Umount the targeted drive partition. In my case:
    • umount /sda1
  6. Write the replace MBR to the drive:
    • dd if=/usr/lib/syslinux/mbr.bin of=/dev/sda bs=1
  7. reboot

Note!: This was a "long shot" action on my behalf and thus a risk on anyone following these instructions. The contents of the file mbr.bin were a guess on my part as was the correct use and application of dd. While this works, you should know that your results may vary greatly. Use these instructs only as a last resort! Please read the disclaimers section.


References:

Disclaimer:
This solution worked for me. It may or may not work for you. I am not responsible for your actions nor the your results of your actions should you act on what you read here. I do not claim expertise in this very specific area and only convey my experience. There is no warranty on this
(and most) free information.

No comments: