I have RAID1 md0 for /boot consisting of 4 partitions (sda2, sdb2, sdc2, sdd2). I'm using GPT on 2TB HDDs, so first partitions on each disk (sda1, ...) are 1-megabyte bios_grub partitions.
I also have RAID10 md1 for LVM (containing /) and RAID0 md2 for swap, both built from partitions on all 4 drives.
mdadm persistant superblock version is 0.9.
Grub was installed with something like grub-install --modules="mdraid lvm" '(hd0)'
on all 4 drives (hd0, hd1, hd2, hd3).
The problem.
On reboot, grub2 fails with "error: no such disk" and displays "grub rescue>" prompt.
ls
command only shows 4 disks and their partitions - but no md*
devices.
Trying insmod normal
again gives "error: no such disk.".
Examining 'root' and 'prefix' shows something like '(md0)/grub', which is correct.
Doing set prefix=(hd0,2)/grub
and then insmod normal
allows to boot normally.
The question.
Why grub2 doesn't see md0?
So far the only solution I can see is to manually build grub image with hard-coded working prefix (grub-mkimage --prefix='(hd0,2)/grub'), then use grub-setup to write the image to each disk. However, this solution is ugly, and error-prone (to avoid errors, will need to investigate how grub-install calls these two commands). I will appreciate better solutions. (Note: this is a remote server, so cannot really do 'reboot debugging'.)