The following comment confuses me:

It just so happens, that dracut has code in the shutdown routine, which shuts down all raid arrays...

For non-root disks this should be part of an mdadm service.

Linux has supported root on software RAID for many years, without the more powerful shutdown to initramfs technique supported by dracut. So I've double-checked and it still works fine on Debian 9, which doesn't have dracut or /run/initramfs/shutdown. Rebooting it does not cause a resync to show up in /proc/mdstat. There's actually no mdadm.service in /lib/systemd/system, only a mask file to disable /etc/init.d/mdadm, whatever that did.

What is the significance of userspace stopping RAID arrays during shutdown using mdadm? Why does dracut do this? Is it ever necessary to do this to avoid an unclean shutdown of the array (requiring a future resync), as encountered in the bug linked above? I notice the original bug report is about IMSM, which mdadm does not support all features of.

Or is the only significance that if userspace drives the process, it can respond to errors e.g. showing some more comprehensive message than the kernel would have, attempting to log it somewhere, etc?


The comments suggest following dracut by using


For each md device given, or each device in /proc/mdstat if --scan is given, arrange for the array to be marked clean as soon as possible. mdadm will return with success if the array uses external metadata and we successfully waited. For native arrays this returns immediately as the kernel handles dirty- clean transitions at shutdown. No action is taken if safe-mode handling is disabled.

It seems that stopping arrays in userspace is only required for non-"native" arrays. No definition of "native" is given, but it would be plausible if this qualifier was inserted to distinguish something like IMSM.

To be fair, this is the sort of quality you might expect from features like IMSM (and fakeraid more generally), that Linux developers / vendors are not especially interested in. AFAICT it does not directly cause data loss (it "only" removes the benefit of full redundancy for however long it takes to resync the disks).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.