MBR Corrupted (error 15)

I was rebuilding RAID on my production server and due to some unexpected reason sever got rebooted automatically before I could complete grub configuration, MBR got corrupted , was getting error 15 on grub  prompt. I had been breaking my head from two hours , then found a link which helped me to recover from this situation.

http://www.linux.org/threads/centos-mbr-corrupted-error-15.237/

I just want to share How can you easily recover from this

Step 1:-  Reboot your server in rescue mode.

Step 2:- Mount your root partition to /mnt ,In my case / was mounted on /dev/md1.(I am using RAID1)

            mount  /dev/md1  /mnt

Step 3:- mount proc ,usr, and dev partiton to /mnt ,  Grub error 15 comes due to missing dev directory , it is important to mount this also.

 mount  -t proc none /mnt/proc

 mount  –rbind  /dev  /mnt/dev

 mount  /dev/mapper/vg00-usr /usr

Step 4 :- chroot to mnt directory

   chroot /mnt  /bin/bash

Step 5 :- source  /etc/profile

Step 6 :- cd /boot/grub

              grub-install  /dev/sda

At this stage you can reboot your server but better to follow the below steps of grub configuration :-

grub> device (hd0) /dev/sda
grub> root (hd0,0)
grub> setup (hd0)
grub> device (hd1) /dev/sdb
grub> root (hd1,0)
grub> setup (hd1)

I hope this helps you

Leave a Reply