How-to change the name of an MD device (mdadm)
Solution 1
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).
Solution 2
Just to add to haimg's excellent answer. It may happen that even with a mdadm.conf, the system (at least for Ubuntu) may still auto-assemble the arrays prior to reading mdadm.conf. So when it finds it it just ignores the arrays that have just been assembled anyway.
To account for that, run sudo update-initramfs -u
to regenerate the proper initrd.
Relevant links: http://ubuntuforums.org/showthread.php?t=1764861%29%3a
Solution 3
None of the other answers worked for me but in Centos I used the following guide. The issue is that /etc/mdadm.conf is not really used at boot time and only gets updated when a new kernel is installed or initramfs is manually recreated. So essentially you just need:
dracut --force
source: http://realtechtalk.com/mdadm_change_wrong_device_name_md127_fix_and_solution_in_Linux-1783-articles
Solution 4
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.
![USB](https://i.stack.imgur.com/WcUqd.jpg?s=256&g=1)
USB
Updated on September 18, 2022Comments
-
USB almost 2 years
I am trying to run Hadoop Wordcount on Tachyon. I followed this link. But once I run wordcount Jar with below command
hadoop jar HadoopWordCount-0.0.1-SNAPSHOT-jar-with-dependencies.jar edu.WordCount -libjars tachyon-client-0.7.1-jar-with-dependencies.jar tachyon://tachyon_ip:19998/wordcountsample/word2.txtaa /OUT/wcTachyon
I am getting below error.
Error: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class tachyon.hadoop.TFS not found at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2112) at org.apache.hadoop.fs.FileSystem.getFileSystemClass(FileSystem.java:2578) at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2591) at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:91) at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2630) at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2612) at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:370) at org.apache.hadoop.fs.Path.getFileSystem(Path.java:296)
I am new to Tachyon.
Please advice.
-
XXL over 12 yearsI 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?
-
Gilles 'SO- stop being evil' over 12 years@XXL That number is not stored anywhere, it is chosen rather arbitrarily when the array is assembled.
-
XXL over 12 yearshmm.. 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 over 12 yearsvery good! just what i was looking for. so the trick was to also update the super-minor.. thank you!
-
Vlad about 12 yearsYou're a life-saver! I used this to unbrick a WD NAS device which uses md.
-
nh2 over 5 yearsThis fixed the problem for me (after another reboot) on Ubuntu 16.04. In my case it was because I had recreated the array, and it had a new UUID. After updating it in
mdadm.conf
, rebooting alone was not sufficient; updating the initramfs did the trick. -
yahol over 5 years+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