How to Restore a Linux Master Boot Record (MBR)

Here is what led up to my needing to restore the master boot record on my Centos 5.4 desktop (8 GB RAM, 4 - 500GB SATA drives, drives 0 and 1 and /dev/sdb combined using LVM):

  1. I decided I wanted to try dual booting Ubuntu 9.10 on the third drive (sdc)
  2. After installing, I could no longer boot to Centos

Here is what I did to restore the MBR:

  • Boot from the CentOS 5.3 DVD
  • Reply to the language (English) and keyboard (US) prompts
  • When asked about booting, press F5 (rescue)
  • When prompted, choose "linux rescue" (or enter it at the command line)
  • When prompted, choose "chroot /mnt/sysimage" (or enter it at the command line
  • Enter "/sbin/grub-install /dev/sda" (It should report success.)
  • Reboot the system