Fedora server /dev/md0 on f40 became /dev/md127 on f41

I update my file server that uses BIOS RAID.
The system-upgrade completed, but the system failed to reboot.

What had happened is that /dev/md0 was now /dev/md127.
I had to fix /etc/crypttab so that the disk could be accessed.

Anyone know why md0 flipped to md127?

Added server

You should never use /dev/mdX in crypttab or fstab – these paths are not guaranteed to be stable and can change even between two reboots (same applies to /dev/sdX). Always use unique identifiers like UUID=<uuid> or stable paths like /dev/md/<name> in config files.

2 Likes

Interesting; that mapping has been stable for 4.5 years!
I did not understand its not supposed to be stable, and I was lucky.

I’m trying to figure out where the name of the RAID is setup.
I have this in /etc/mdadm.conf, it’s got the /dev/md0 in it

Reading the man page for mdadm I ran the examine command.

$ cat /etc/mdadm.conf
ARRAY /dev/md0 name=fender.shares

$ ls -l /dev/md/fender.shares_0
lrwxrwxrwx. 1 root root 8 2024-11-04 15:31:36 /dev/md/fender.shares_0 -> ../md127

$ mdadm --examine --scan
mdadm: ARRAY line /dev/md0 has no identity information.
ARRAY /dev/md/fender.shares  metadata=1.2 UUID=9ebc84a0:c29e88b1:822e8b76:f3608340

I looks like I need to

  1. update the /etc/mdadm.conf to match the --examine output.
  2. update /etc/cryptsetup to use the /dev/md/fedora.shares (after seeing is the _0) is present or not.

I’ll do this tomorrow when I’m fresh and update here.

It is not that

but rather that it is not guaranteed to be stable.

Using the UUID is (almost 100%) guaranteed to never change by itself, while the device name seen during config while booting may change as you encountered.

In my experience, if you define an array as md0 when first defining it the name seems stable since it is written into the array metadata on the drives. If you allow it to be defined by default that name is not written into the metadata and is created at boot time. (It seems md127 is the default for the first array created on a system.) The hostname and host machine id seem also part of the array metadata and may cause problems if the array is moved to a different host if not exported on one host then imported to the new host as well.

$ sudo mdadm --examine --scan
ARRAY /dev/md/fedora_raid  metadata=1.2 UUID=c66f241a:545ce2fa:d2006841:9423bfe0 name=eagle.home.domain:fedora_raid

Note that the name contains the name of the host where the array was originally created even though the host using it is different. The name is contained in the array metadata.

I do not use encryption on this array.

1 Like

I have this working with the following config:

$ cat /etc/mdadm.conf
ARRAY /dev/md/fender.shares metadata=1.2 UUID=<uuid>
$ cat /etc/crypttab
...
crypt_shares /dev/md/fender.shares none discard

Now that I have a valid mdadm.conf the name “fender.shares” is as configured, no _0 on the end.

Thanks for all insight. Always something new to learn!

1 Like