-   Linux - Hardware (
-   -   Replacing a drive in /boot, software RAID-1 + GRUB (

tobiasly 12-19-2005 09:34 AM

Replacing a drive in /boot, software RAID-1 + GRUB
I have a Linux (CentOS 4.2) file server for my home LAN on which the /boot partition is a software (mdadm) RAID-1 array using two equally-sized partitions on a couple SCSI drives.

I need to replace one of the drives, and want to make sure that both are capable of booting the OS with GRUB. So if this were just a regular RAID array, it'd be a simple matter of replacing the drive and reassembling the array. But how do I make sure that both have the correct boot info and initrd images?

I'm pretty comfortable with most Linux admin tasks but when I start reading up on GRUB and superblocks my head starts to spin... just when I think I've got it right, I end up b0rking my system and making it unbootable. Any help on the specific GRUB steps to take would be highly appreciated!

WhatsHisName 12-21-2005 12:08 AM

To make you feel better, make a backup copy (cp -a...) of /boot somewhere in the “/” partition/logical volume (e.g. /boot_backup) before you start. That way, if all else fails, you can always recreate the Raid1 and repopulate it from the backup.

You shouldn't need to do anything about grub or anything else, if you remove the “bad” drive in rescue mode (resulting in a “degraded” raid1), physically put in the new properly partitioned drive and then add the new partition to the Raid1 in rescue mode. The “degraded” Raid1 will be rebuilt within seconds of adding the new partition to the Raid1 and everything will be like new again.

From rescue mode, you can prove it to yourself by intentionally failing and removing one of the Raid1 partitions and then adding it back, something like this (using the correct raid and partitions. of course):

# mdadm /dev/md0 -f /dev/sdb2 -r /dev/sdb2
# mdadm --detail /dev/md0
# mdadm /dev/md0 -a /dev/sdb2
# mdadm --detail /dev/sdb2

where --detail will show you the status of the Raid1. If you run the second --detail quickly after adding the partition, you will catch it in the middle of rebuilding the Raid1.

If you are concerned about grub, then make a grub boot floppy as is described in the Grub Manual:

Then, if something goes wrong, you can reconfigure grub natively by following the instructions here:

All times are GMT -5. The time now is 09:21 PM.