[systemd-devel] Need help with a systemd/mdadm interaction.
NeilBrown
neilb at suse.de
Mon Nov 11 16:31:45 PST 2013
Hi,
I wonder if I could get some advice....
mdadm is quite good at assembling arrays incrementally. "udev" runs
"mdadm -I" for each new device and mdadm gathers them into arrays and
activates the array once all the expected devices have been gathered.
This simple rule falls down if some expected device doesn't appear.
If an array is marked as degraded then mdadm doesn't expect the missing
device and will happily start the degaded array. However if the system shuts
down with the md array fully functional, and a device is removed before the
system is restarted, then mdadm does not know that the device is missing and
will effectively wait for it forever.
mdadm can handle this, but it needs to be told. The command:
mdadm -IRs
will find any arrays which have enough devices to start degraded but haven't
been started yet, and will start them.
I used this quite effectively in out initrd. There is a loop that count up
to N waiting for the root device to appear and when we get to "N/2" I run
"mdadm -IRs" which makes any newly-degraded arrays appear.
I'm wondering how to integrate this with systemd. Systemd has its own
mechanism to wait for devices to appear, but I cannot see anyway to run
"mdadm -IRs" at the half-way mark.
It would of course be sufficient to wait for the complete timeout, then run
"mdadm -IRs", then check if the device has appeared, but I can't see how to
fit this into systemd either.
So: how can I fit this need for "run some command on device timeout which
might be successful in activating the device"?
Alternately, is there some "all devices have been probed, nothing new will
appear unless it is hot-plugged" event. That would be equally useful (and
probably mirrors what hardware-RAID cards do).
Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20131112/b76540df/attachment.pgp>
More information about the systemd-devel
mailing list