Comment 42 for bug 136252

We are missing pure and secure UUID-only incremental assembly (i.e. allowing "DEVICES partititions", "ARRAY <any>" and "HOMEHOST <any>").

One that would create unique disk/by-uuid nodes and by-label symlinks (the later might get numbered on conflicts). This scheme may not even expose any of the generally arbitrary md* device enumaration to userpace/filesystem, just like the device mapper under /dev/mapper. (Yes, this is disregarding the unreliable and fluctuating major-minor numbers as well as hostnames replicated on superblocks around the world.) Each raid member showing up is added to the system either creating a new UUID node or (incrementally) added to the matching UUID node.

How to test/implement this concept, now?

Maybe, let /lib/udev/rules.d/85-mdadm.rules dynamically update the mdadm.conf prior to calling mdadm --incremental.

# grep --invert-match ARRAY mdadm.conf > /etc/mdadm/mdadm.conf-stripped
# cp /etc/mdadm/mdadm.conf-stripped /etc/mdadm/mdadm.conf
# echo "ARRAY uuid=${<uuid-variable-from-udev>}" >> /etc/mdadm/mdadm.conf

This way mdadm --incremental always sees a mdadm.conf containing a "ARRAY uuid=<uuid-of-new-device>" line, should allways assemble, but never based on wrongly matching minors, labels or hostnames in superblocks.

This should currently still create /dev/md* devices, but after switching to use UUIDs in boot scripts etc. this should not lead to false matches.