LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   repair grub with RAID5 (https://www.linuxquestions.org/questions/linux-software-2/repair-grub-with-raid5-563560/)

kristof_v 06-21-2007 03:22 PM

repair grub with RAID5
 
I'm running a software RAID5 system and I'm simulating some worst case scenarios.
the system is set up like this:

Code:

sata1 (disk 0):
-------------------
/boot: 100 MB
rest is for RAID5 + LVM (500G)

sata2 (disk 1):
-------------------
everything for RAID5 + LVM (500.1G)

sata3 (disk 2):
-------------------
everything for RAID5 + LVM (500.1G)

sata4 (disk 3):
-------------------
everything for RAID5 + LVM (500.1G)

this system works great.
then I removed disk 2 from the array and formatted it.
after that I put the disk back in the RAID and rebooted the system.
the kernel complained that volume group was corrupted etc (which is normal offc)
so I booted into single user mode and added the disk again to the array, the syncing started and after a while the data was restored.
Test case succeeded :)

Onto the next worst case scenario:
suppose disk 1 crashes (the disk with the /boot partition), then the system won't boot anymore.
So I simulated this by taking out disk 0 and formatting it.
Then I tried to restore it by making again 2 partitions, 1 of 100 MB for /boot and the rest for RAID.
I also had a copy of all the contents from the original /boot so I copied this to the new /boot partition.
But the system won't boot anymore.
I also tried with grub-install in knoppix, but I can't restore it.

Any ideas on how to recover from a scenario like this??

grtz

rtspitz 06-21-2007 05:34 PM

put /boot on raid1

disk1: d1p1, d1p2
disk2: d2p1, d2p2
disk3, d3p1, d3p2


* d1p1 + d2p1 --> raid1 /dev/md0 --> /boot

* d1p2 + d2p2 + d3p2 --> raid5 /dev/md1 --> LVM

install grub on disk1 and disk2

example: (disks must be synced before that = system installed on both)

> grub
> device (hd0) /dev/sda
> device (hd1) /dev/sdb
> setup (hd0)
> setup (hd1)
> quit

of course this grub procedure must be matched with the device.map file and the menu.lst entries. now if one of the 2 system disks should fail you can use the other one to boot, resync and reinstall grub like above. as no devices like /dev/hda would be mounted but only raid/lvm devices shifting the order of disks may not be a problem as during the boot phase the physical devices should be scanned for raid signatures and assembled accordingly - no matter if the device names have changed or not (should be tested!)

what I don't understand is why your system complained about corrupted LVM ! ? !
the raid5 layer below lvm should have coped with one missing disk and your system should have booted normally (except for the raid error).

Quakeboy02 06-21-2007 05:48 PM

You should be able to put a copy of the MBR (first 446 bytes of sector 0 of boot disk) on a CD/floppy and restore from that. There is also a program called "Super Grub Disk" that bailed me out once on my test system which boots from a FakeRaid array. Actually I had just restored a backup onto the array to install the OS and couldn't get grub installed. SGD fixed it right up.


All times are GMT -5. The time now is 04:42 PM.