Re: naming system of raid devices
From: Reindl Harald <hidden>
Date: 2021-01-01 16:16:13
Am 01.01.21 um 16:28 schrieb c.buhtz@posteo.jp:
In the last weeks I played around with mdadm - on VMs, Odroid-Devices, PCs - all with Debian 10. I observed a (for me) curious behavior about the naming of RAID devices. I did "--create /dev/md0" all the time. But sometimes it results in /dev/md127. Sometimes it is /dev/md/0. Sometimes it switches between upgrade of the kernel image (/dev/md127 become /dev/md0 and booting fails). Googleing this topic brings up a lot of other users discussing about that problem. My current solution is to ignore the /dev/*-name and mount the device/partition by its UUID.
you should do that for about 20 years anyways, no matter RAID or not
Another often reported "solution" is to edit the mdadm.conf. But this is not a good solution for me. mdadm looks in the superblock and knows (nearly) everything. Each conf-file I need to edit keeps the possibility for errors/mistakes/faults (because I am not a sysop/admin but a simple home-server-wannabe-admin).
but how often is anything changed there? my mdadm.conf is from 2011 and it's not even the same machine with my disks which are in the meantime replaced by SSD you need to make sure that the current config is part if the initrd (dracut -f as example) which happens anyways when the kernel is updated and a new initrd is generated for the new kernel --------------------- [root@srv-rhsoft:~]$ lsinitrd | grep mdadm -rw-r--r-- 1 root root 315 Aug 16 2014 etc/mdadm.conf --------------------- [root@srv-rhsoft:~]$ cat /etc/mdadm.conf MAILADDR root HOMEHOST localhost.localdomain AUTO +imsm +1.x -all ARRAY /dev/md0 level=raid1 num-devices=4 UUID=1d691642:baed26df:1d197496:4fb00ff8 ARRAY /dev/md1 level=raid10 num-devices=4 UUID=b7475879:c95d9a47:c5043c02:0c5ae720 ARRAY /dev/md2 level=raid10 num-devices=4 UUID=ea253255:cb915401:f32794ad:ce0fe396 --------------------- "localhost.localdomain" is intentional, there is a second machine with identical UUIDs all over the place cloned by move two disks, resync on both and adjust runtime config like networking and so on
My Question is how this names come up? How does mdadm, the kernel or what ever component is responsible here, decide about the "name" of a raid device? And which factors influence the re-nameing of such devices (e.g. between boot or kernel-updates)?
devices are always a problem because it's unknown when they appear, it's even unknown *if* they appear so nothing can wait for them that's why you should always work with UUID