I'm facing a really annoying bug, I have set up a Software RAID1 with mdadm, and the setup went just ok with this results
/dev/md/lucas.mgscreativa.com.ar:0
I have also configured mdadm.conf like this
DEVICE /dev/sda /dev/sdb
# auto-create devices with Debian standard permissions CREATE owner=root group=disk mode=0660 auto=yes
# automatically tag new arrays as belonging to the local system HOMEHOST <system>
# instruct the monitoring daemon where to send mail alerts MAILADDR root
# definitions of existing MD arrays ARRAY /dev/md/lucas.mgscreativa.com.ar:0 metadata=1.2
name=lucas.mgscreativa.com.ar:0
UUID=c913486a:e62c7ea1:cfb98b6b:253d1f62
And fstab configured like this
/dev/md/lucas.mgscreativa.com.ar:0 /media/data ext4
defaults,noatime 0 0
But, some day, my array name suddenly changed from /dev/md/lucas.mgscreativa.com.ar:0 to /dev/md0, so I have done some changes in fstab and mdadm.conf (of course, after hours and hours of tryal and error) and everything went just ok, but today, AGAIN, the MD number changed from /dev/md0 to /dev/md127!!!
What's going on here? is this a bug I guess.
Is there any way to fix the MD number so my server can work as it shhould, without flaws?
Thanks!
First: you are probably having errors in your array. You need to check its status, immediately.
Example:
You will very likely find that you have errors... those will need to get addressed.
Moving on, you should change the way your fstab is set up, to use UUID instead of using devicename. Use the
blkid
command on your array (or a partition under your array) to get its UUID, then use that UUID to mount it in /etc/fstab.Example:
With this information, I would set my /etc/fstab entry for root to look like this:
Once you've done this, your system will find your partitions no matter whether their device names change or not (for example, if drive cables get swapped around).
You should also set up your
/etc/mdadm/mdadm.conf
to find things automatically without needing any particular drive to be in any particular location:NOTE THAT THERE ARE NO DEVICES SPECIFIED IN THIS CONF FILE. This is a feature, not a bug. With mdadm.conf set up this way, your system will automatically scan all attached drives looking for anything that belongs to your array, and will assemble them all as /dev/md0.
For this answer I am assuming that the array is intact - no failed disks, not other error conditions, just the changing "device number".
What should normally work is to stop the array:
... fix the line referring to the array in
/etc/mdadm/mdadm.conf
(i.e. adjust the name of the device). Then assemble it as follows:(adjust the references to the physical devices to your case).
You should see an output like this:
And if you query the details you should see an updated "Preferred Minor" field. Check with:
Caveats: also, make sure that you mount the device and write to it. Otherwise the change may not take effect. Also,
super-minor
appears to be specific to the old metadata format.NB: I do not know whether you can affect the "name" in the original sense with this. I know you can affect the
X
in the created/dev/mdX
names, however.