Replacing Failed Raid Drive and Grub Install

Scenario / Question:

First drive /dev/sda or /dev/hda failed in a RAID 1 configuration and now system will not boot.

System booting but only getting a prompt that shows grub and a flashing cursor.

Prevent system from crashing on reboot if first drive in RAID Array fails.

Solution / Answer:

Use Linux Rescue mode from the install DVD/CD and manually configure Grub.

Boot into Rescue Mode:

Insert Distro CD/DVD and select Rescue mode

Enter Grub Command Line:

# grub
grub>

Locate grub setup files:

grub> find /grub/stage1

On a RAID 1 with two drives present you should expect to get

(hd0,0)
(hd1,0)

On a RAID 1 with a single drive present you should get

(hd0,0) or (hd1,0)

depending on which drive has failed. (hd0,0) is your first drive, first partition on first drive and (hd1,0) is your second drive, first partition on the second drive.

Install Grub on Master Boot Record (MBR):

grub> device (hd0) /dev/sdb (or /dev/hdb for IDE drives)
grub> root (hd0,0)
grub> setup (hd0)

We made the second drive /dev/sdb device (hd0) because putting grub on it this way puts a bootable mbr on the 2nd drive and when the first drive is missing the second drive will boot. Note if you already physically removed the drive or the drive doesnt show in the BIOS. Then “grub> device (hd0) /dev/sdb” should be “grub> device (hd0) /dev/sda”

This will insure that if the first drive in the Raid Array fails or has already failed that you can boot to the Operating System with the second drive.

Now you can physically remove the failed drive from your system and replace it with a new one.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
Fabio Milano has written 79 articles for us. Fabio Milano is a certified RHCE, MCP, and CFOI. He runs an IT consulting and services company called RDS Support inc. Website:http://www.rdssupport.com
The information provided is for educational purposes only. All content including links and comments is provided "as is" with no warranty, expressed or implied. Use is at your own risk and you are solely responsible for what you do with it.

2 Comments so far

  1. free microsoft points on December 12th, 2010

    Wow, great blog post, I was thinking how to do this. and found across your blog by bing, many userful content here, now that I’ve got a good idea. I’ve bookmarked your web page and also added rss. Please take a look at my site: xbox live points and please keep us informed about your site :-) , thanks!….

  2. Hussein Bharwani on December 12th, 2011

    I’ve used this so many times. Your directions are excellent and easy to follow. I wanted to comment as I nearly have this committed to memory.

Leave a reply