:: Re: [DNG] mdadm 4.5 for daedalus
Top Page
Delete this message
Reply to this message
Author: Rainer Weikusat
Date:  
To: dng
Subject: Re: [DNG] mdadm 4.5 for daedalus
tito via Dng <dng@???> writes:
> On Wed, 25 Feb 2026 21:33:23 +0100
> tito via Dng <dng@???> wrote:


[...]

>> in my case apparently this was not triggered even after rebooting the system
>> cannot say why. Only after adding the rule and running udevadm trigger
>> the symlink was created and DeviceDisappeared messages stoppped.
>> Have no Idea how this could be debugged tough. Let me know
>> if you have any ideas. Can do some tests on this machine even tough
>> it is a production one.


The automatically created symlinks in /dev/md are only the md device
numbes, ie, without the leading md.

> P.s.: I suspect mdadm expects /dev/md/mdX when run as mdadm --monitor --scan --oneshot (by e.g. cron)
> but creates a mdadm.conf with /dev/md0 when run as mdadm --detail --scan
>
> ARRAY /dev/md0 metadata=1.2 spares=1 UUID=705d30b8:1b64bf1b:8d5bf391:65e26d6f
>
> even when /dev/md/md0 symlinks are already created.


I've had a close look at this. As far as I can tell, the only way to get
this device disappeared event is to have an entry like this in
mdadm.conf:

ARRAY md0 metadata=1.2 UUID=0f4fb9df:cf2de137:bd5effb7:44ba4303

ie, without directory. The 4.2 Monitor routine will run this code to add
a directory:

                mdlist = conf_get_ident(NULL);
                for (; mdlist; mdlist = mdlist->next) {
                        struct state *st;


                        if (mdlist->devname == NULL)
                                continue;
                        if (strcasecmp(mdlist->devname, "<ignore>") == 0)
                                continue;
                        st = xcalloc(1, sizeof *st);
                        if (mdlist->devname[0] == '/')
                                st->devname = xstrdup(mdlist->devname);
                        else {
                                st->devname = xmalloc(8+strlen(mdlist->devname)+1);
                                strcat(strcpy(st->devname, "/dev/md/"),
                                       mdlist->devname);
                        }


the auto-completed name will thus be /dev/md/md0 and check_array will
then cause the "disappeared" alert. This won't happen anymore with 4.5
because there's now an additional check that a name is a valid md device
done from this loop and check_array won't be called with this name
anymore if it either couldn't be opened or wasn't a md device (and
hence, there'll be no more alerts about a disappeared device).
?
That was a rather nice investigation, BTW, especially considering that I
just got rejected for another job application on the grounds that I have
'obviously' no technical skills or experience whatsoever.