I've got two drives in RAID1 that serve as the root partition on my workstation. Sometimes (1 out of 10) one of the drives is not detected, and thus not included in the raid. As the drive is not detected at all I cannot reattach it that time (and I may not even notice it, at least not right away).
Once after such a time, I rebooted and the kernel used the previously undetected drive for md0. After that I ran
mdadm --add and it just re-added the other half of the array, not reconstrucred it, thus I had an inconsistent array (I ran a check and mismatch_cnt came up with more than 300k blocks!). In the end, I failed one of the drives and then re-attached it, thus doing the reconstruction that should have been done in the first place.
To avoid such situations in the future, I want to detect such errors as early as possible: in GRUB or during boot, before the root file system is mounted. This is a desktop, so turning off and on again in such case is not that much of a problem. Also, I am willing to take manual measures (i.e. booting from a live CD to remove the boot block) if the disks really fail.
Is there a grub/kernel parameter that prevents boot in case of a raid disk's absence? Or the only way to do so is to modify the init scripts on the initramfs?