Bug#639830: mdadm: alternative md-device names

Michael Tokarev mjt at tls.msk.ru
Sat May 26 15:26:44 UTC 2012


On 26.05.2012 19:03, Cristian Ionescu-Idbohrn wrote:
[]
>> Note also that you still have the same inconsistency -- you list
>> /dev/md/0 in mdadm.conf, but use /dev/md0 as root filesystem. I
>> can't say it works by design, more by a chance, it is better to
>> use consistent naming there.
> 
> Alright.  You possibly mean changing /etc/fstab?  Is /dev/md/0 the
> preferred device name (and /dev/md0 an alias) or the other way around?

Well.  This is an interesting question.

I'd say it is similar to /dev/sdXY and /dev/disk/by-*/*.  Which is
"primary" and which is "alias" is impossible to say.  In real life,
/dev/disk/* is a symlink to /dev/sdXY, so /dev/sdXY is a device node
and /dev/disk/* is an alias.  But /dev/sdXY, while "primary"
according to this "definition", is actually some random XY, it may
change on next reboot (or even during system runtime), -- say,
because you unplugged and replugged the corresponding drive.  But
/dev/disk/* will always have the same name and will always point
to _current_ incarnation of the drive in question.

So based on this, it is really impossible to say which is primary
and which is alias - it depends on your PoV.

For md devices, things currently are similar: /dev/mdX is actual
device node, while /dev/md/X is a symlink.  And for md device names
it is actually possible to not have such a double naming, by always
using only one /dev/md/X name -- for the actual _device_ node, not
a symlink.  But this means compatibility will be broken, which is
a no-no.  So we have what we have: historical naming scheme plus
"more user-friendly" naming scheme.

Note that the /dev/md/X name may be some string, not only number --
like, /dev/md/myfancyraid5array.  It will be a symlink to something
like ../md128 (with 128 is next free number >=128).  But if X is a
number <128, it will be the same X in /dev/mdX as in /dev/md/X, and
the same minor number too.

Traditionally there were only /dev/mdX names (0 <= X <= 127 IIRC),
and when "free" naming were introduced /dev/md/ prefix was used,
but now for these traditional mdX names we've two alternative
naming schemes, neither of which is "primary" or "main".

BTW, the same thing can be said about dm nodes, and there we'v some
disparity too.  LVM has always used /dev/mapper/* names, but these
has always been symlinks to /dev/dm-XX (where XX is just next free
number).  These dm-XX names weren't mentioned much in documentation,
but you may see them in output from various tools like df, or in
kernel messages - and now it is more difficult to map from dm-XX to
the actual array name in /dev/mapper/*.  And they actually have
two naming schemes -- /dev/mapper/vg-vn and /dev/mapper/vg/vn, --
neither of which is "primary" either.

>> W: mdadm: I am supposed to start /dev/md0 from the initial ramdisk,
>> W: mdadm: yet I cannot find the array in the configuration file.
>> W: mdadm: I am thus reverting to starting all arrays.
> 
> Yes, I do recall those messages ;)

Okay, this is *excellent* Cristian!  I was worried about these -- if
you didn't see the warnings, it means the problem is elsewhere.  Now
when you confirmed you've seen them, I can be sure I identified the
issue correctly.  The only question left is how to fix it (which I
mentioned in another email), I'll think about it more...

Thank you!

/mjt





More information about the pkg-mdadm-devel mailing list