Linux Software RAID10: Mysterious renaming /dev/md0 to /dev/md127: Why?

During the last two nights we had mysterious events on a server running Ubuntu Linux 12.04 LTS with a Linux mdadm software RAID10:

DeviceDisappeared /dev/md0
NewArray /dev/md127

Both messages appeared in the same second, on the same time as the logrotate cron action happened. Although the array is still named /dev/md0 in /etc/mdadm/mdadm.conf, it appears as /dev/md127 in the output of cat /proc/mdstat:

Personalities : [linear] [multipath] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] 
md127 : active raid10 sdb1[0] sdg1[5] sdc1[1] sdh1[6] sdf1[4] sdd1[2] sdk1[9] sdj1[8] sde1[3] sdi1[7]
      9746600960 blocks 512K chunks 2 near-copies [10/10] [UUUUUUUUUU]

unused devices: <none>

Why is this so and how can I fix this?


I figured it out: The UUID in the file /etc/mdadm/mdadm.conf did not match the UUID of the actual software raid array in this server due to some "uncareful" sysadmin activity which happend three days ago. Editing the UUID in this file to the UUID displayed by (in my case, YMMV) the command:

mdadm --examine /dev/sdb1 

and recreating the initrd images using the command (see EDIT2021 below):

update-initramfs -u -k all

and a following reboot fixed the naming back to /dev/md0.
EDIT: @Michael Hamptons comment: The device name /dev/md0 mentioned in the ARRAY line in the configuration file /etc/mdadm/mdadm.conf might be possibly replaced by something like for example /dev/disk/by-label/DATA. But I've not tried this yet: The examples in the manual page of mdadm.conf use device names like /dev/md*. I'm not sure whether such a replacement is possible: The more abstract device names in /dev/disk/by-label/* or /dev/disk/by-uuid/* are created dynamically later on.

EDIT 2021: The above mentioned command:

update-initramfs

is a script specific to Debian/Ubuntu derived flavors of Linux distributions. On RedHat derived distributions (Fedora, CentOS, etc...) it is possible to create a new initramfs file for the currently active kernel using the following command:

mkinitrd /boot/initramfs-`uname -r`.img `uname -r`