[CentOS] Software RAID + LVM + Grub

Sat Sep 18 21:47:51 UTC 2010
Tom H <tomh0665 at gmail.com>

On Sat, Sep 18, 2010 at 2:41 PM, Matthew Topper <topperm9 at gmail.com> wrote:
> On Sat, 18 Sep 2010 17:42:59 +0200 Timo Schoeler <timo.schoeler at riscworks.net> wrote:
>
>> On 09/18/2010 05:13 PM, Matthew Topper wrote:
>> > I'm playing with software RAID and LVM in some virtual machines and
>> > I've run into an issue that I can't find a good answer to in the
>> > docs.
>> >
>> > I have the following RAID setup:
>> >
>> > md0: sda1 and sdb1, RAID 1.  This is /boot
>> >
>> > md1: sda2 and sdb2, RAID 1.  This is a PV for LVM.
>> >
>> > VolGroup00, this is the volume group and md1 is the only PV in it.
>> >
>> > LogVol00 is swap
>> > LogVol01 is /
>> > LogVol02 is /home
>> >
>> > So, I tested to see what happens if I disable sdb in virtualbox.
>> > Machine booted find and I was able to see that part of the raid
>> > array was gone.
>> >
>> > I reattached the disk and rebuilt the array
>> > mdam --add /dev/md0 /dev/sdb1
>> > mdam --add /dev/md1 /dev/sdb2
>> >
>> > The array rebuilt without issue.  But now, if I remove sda, the
>> > machine doesn't boot and grub complains.  The question I have is
>> > how does one reinstall the boot sector at this point?  I'm a little
>> > confused as far as to what device to install it on and what to
>> > specify as the root.
>> >
>> > This is grub.conf if it helps:
>> >
>> > default=0
>> > timeout=5
>> > splashimage=(hd0,0)/grub/splash.xpm.gz
>> > title CentOS (2.6.18-194.e15)
>> >     root (hd0,0)
>> >     kernel /vmlinuz-2.6.18-194.e15 ro
>> > root=/dev/VolGroup00/LogVol01 initrd /initrd-2.6.18-194.e15.img
>> >
>> > Grub has always been a little confusing for me, so I guess I don't
>> > understand.  What do the two root entries specify?  And again, my
>> > main question is how do I reinstall grub to the repaired disk?
>>
>> http://wiki.centos.org/HowTos/CentOS5ConvertToRAID#head-fa2b73a28acdf965daa1e018962eaa8cbd94110c
>
> Entering those commands exactly worked, but I'm not sure why it
> worked.  So, it's progress.
>
> I need to find some good reference on GRUB, which seems difficult
> because most things I can find are about GRUB2, and CentOS has 0.97

The commands installed grub into the mbr of sdb that way you can boot
from either sda or sdb if the other is missing.

You should always do that when booting from raid1
http://wiki.centos.org/HowTos/SoftwareRAIDonCentOS5

GRUB1 manual
http://www.gnu.org/software/grub/manual/legacy/grub.html

Good link (AFAIR)
http://members.iinet.net.au/~herman546/p15.html