[CentOS] Re: Replacing failed software RAID drive

Tony Mountifield tony at softins.clara.co.uk
Wed Oct 10 07:31:37 UTC 2007

In article <470C47EF.2050908 at gmail.com>,
Les Mikesell <lesmikesell at gmail.com> wrote:
> Hugh E Cruickshank wrote:
> > From: Les Mikesell Sent: October 7, 2007 18:53
> >> OK, you just have to replace the drive, fdisk matching partitions on it 
> >> ("fdisk -l /dev/sde" will show the sizes you need), then use
> >> mdadm --add /dev/md? /dev/sda?
> >> for each one to add the missing partition back.

You can also replicate the partitioning of one disk onto another new disk
using sfdisk like this:

# sfdisk -d /dev/sda | sfdisk /dev/sdb

The above would partition the new disk /dev/sdb to be exactly like /dev/sda.
This assumes both drives are the same size.

This is the sort of command you check three times before pressing ENTER!

> > I have been able to review all this and it looks very straight forward.
> > 
> >> Then reinstall grub on the drive.
> > 
> > Now I have some questions:
> > 
> > 1. Since the /boot partition was mirrored and will be restored on the
> >    new sda drive I do not really want to do a full grub install. From
> >    what I have read that will overwrite existing /boot/grub/grub.conf
> >    file. So I just want to write the MBR on the drive. How to I do
> >    that (the docs I have found were rather unclear on that aspect)?
> > 
> > 2. Can a install grub on the replaced boot drive with the system still
> >    running?
> Yes, after the /boot partition re-sync has completed, execute grub and:
> root (hd0,0)
> setup (hd0)

And also:

root (hd1,0)
setup (hd1)

> quit

That will ensure both mirrored drives have GRUB in the MBR (the MBR isn't
mirrored, only partitions are). Otherwise if hd0 fails, the system will
be unable to boot from the good drive hd1.

See http://fedoranews.org/mediawiki/index.php/How_to_setup_and_manage_your_disk_software_mirroring

Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org

More information about the CentOS mailing list