Warning: Please make a backup before following any advise given here :-)
Option #1:
Edit /etc/mdadm.conf
:
ARRAY /dev/md1 level=raid0 num-devices=2 UUID=d89d9d45:9a420812:c44c77eb:7ee19756 devices=/dev/sdb8,/dev/sda8
I just entered your own output and changed 127 to 1. Reboot and it should be md1 now.
Option #2:
If you don't have mdadm.conf
, and want it to assemble to md1 automagically, you can do this:
mdadm has a concept of a "preferred minor". E.g. once a certain minor number is assigned to an array, and stored in the superblock, it will be used each time this array is auto-assembled. Verify this:
mdadm --detail /dev/md127
If it says "Preferred Minor : 127" this this is your problem. You need to update the preferred minor. How to do this:
You cannot just change the preferred minor. You need to boot into recovery or single user-mode if this is your root device, unmount the filesystem, after that:
mdadm --stop /dev/md127
mdadm --assemble --update=super-minor /dev/md1 /dev/sdb8 /dev/sda8
Then you'll have your md127 assembled as md1. And it should stay this way in the future too.
With 1.x arrays:
Newer arrays don't store a 'Preferred Minor' number and do not support "--update=super-minor". Instead they store a name which can be changed with:
mdadm --stop /dev/md127
mdadm --assemble --update=name --name=2 /dev/md1 /dev/sdb8 /dev/sda8
Or you can specify 'hostname:2' to keep everything consistent with other arrays (lookup the current name with --detail).
This solution is theoretically correct, but it was difficult for me to implement for me on living system. Also Option #1 did not work for me. I went with http://superuser.com/questions/287462/how-can-i-make-mdadm-auto-assemble-raid-after-each-boot/909414#909414
– gorn – 2015-05-04T02:55:01.580+1 for the last part of the solution which was very helpful when moving raid array from one machine to another. 'hostname:2' and changing md127 to md1 was exactly what i needed to keep names consistent – yahol – 2019-01-01T11:18:55.413
very good! just what i was looking for. so the trick was to also update the super-minor.. thank you! – XXL – 2011-10-15T16:58:57.617
You're a life-saver! I used this to unbrick a WD NAS device which uses md. – Vlad – 2012-05-23T20:57:32.893