Here is the output from mdadm -Esv:

ARRAY /dev/md127 level=raid0 num-devices=2 UUID=d89d9d45:9a420812:c44c77eb:7ee19756 devices=/dev/sdb8,/dev/sda8

This is a v0.90 array. The question is as follows: how does mdadm assign the name for an according device, where does it store it and how does one change it?

What I want to accomplish is to rename md127 to something different to my liking.

link|improve this question

45% accept rate
feedback

2 Answers

up vote 3 down vote accepted

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.

link|improve this answer
very good! just what i was looking for. so the trick was to also update the super-minor.. thank you! – XXL Oct 15 '11 at 16:58
You're a life-saver! I used this to unbrick a WD NAS device which uses md. – Vlad May 23 at 20:57
feedback

Version 0.9 superblocks don't have a name, they were introduced in version 1. /dev/md127 is not the name of the array, it's the name of the array's device file, which is a direct consequence of the raid block device's minor number. This minor number is chosen rather arbitrarily when the array is assembled.

The UUID provides a unique identifier for the array, if you need one. If you prefer a human-readable or structured name, put an LVM physical volume in the array.

link|improve this answer
I am aware of the possibility of --homehost from the later version, that is why I have deliberately stated that this is a v0.90 metadata array. However, that is not my intention nor is it compatible. Looking through my posts I also somewhat can not notice where I mentioned that /dev/md127 was the name of the array. I think I have provided the exact details of what I want to do. So the question still remains, how do I change it and where is this "minor number" stored? I presume it is part of the superblock? Will it ruin the superblocks checksum, when hex-edited? – XXL Oct 14 '11 at 21:39
@XXL That number is not stored anywhere, it is chosen rather arbitrarily when the array is assembled. – Gilles Oct 14 '11 at 21:46
hmm.. I do not understand. Then why do I always get /dev/md127 when i mdadm -Esv? Shouldn't I get something else, that is random, other than a static name? That is if it is really "arbitrary".. – XXL Oct 14 '11 at 21:51
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.