Greetings, I discovered a possible reason for mdadm always marking my raid array as bad on reboot. The problem is I don't know how to check for the issue.
When using root on a native mdadm raid, the kernel handles the array state transition at shutdown, so it's not a big deal. However, it's different when using external metadata - mdadm must be called before the reboot. Apparently mdadm must be called after the root filesystem is mounted read-only. Then it can mark the array as clean and not rebuild every single reboot. Where do I check this? The /etc/init.d/mdadm script happens well before root is mounted read-only. Apparently `mdadm --wait-clean --scan` needs to be called so the external metadata is updated correctly. If you use this command with a native mdadm raid it does nothing, but it's critical apparently to the health of other metadata types. I've grepped through /etc/init.d/ and found nothing. Dan