English version was created automatically using Drupal module auto_node_translate and free DeepL translator.
Is the RAID giving you problems - it has a strange name like /dev/md127 ? The solution is simple.
zveřejněno 2019-11-13
After reinstalling the system, moving the disks to another computer ... the RAID array may be renamed. Fortunately, a few correct commands are enough and we have a nice RAID /dev/md0 back.
In my case, I had two fast SSDs for the system and two large HDDs for data. One day I decided to reinstall the system from Debian 9 to Debian 10. I didn't want to compromise the HDDs during the reinstallation and configuration, so I physically disconnected them. But after installing the system and connecting these disks, they started reporting as /dev/md127, and cat /proc/mdstat still showed messages like auto-read-only and resync=PENDING. So what to do.
There are a lot of tutorials on the net, but it took me a while to find the right one https://askubuntu.com/questions/63980/how-do-i-rename-an-mdadm-raid-arr…. And even that one isn't really complete. We want to mount the renamed RAID via /etc/fstab, using the UUID. But there's no such thing as a UUID.
So here we go.
1) Rename /dev/md127 to /dev/md1
As I said, the system runs as /dev/md0. It has an entry in /etc/mdadm/mdadm.conf
ARRAY /dev/md/0 metadata=1.2 UUID=6a44812f:b6c34f58:975a7bb6:61d53bc8 name=bell15:0
So I'll want to rename /dev/md127 to /dev/md/1 (/dev/md1 will then be created automatically).
Stop the misnamed field:
mdadm --stop /dev/md127
Create the newly named field - nothing should happen to the data. But you know, backup at the first location.
mdadm --assemble /dev/md/1 --name=bell15:1 --update=name /dev/sdc1 /dev/sdd1
Using cat /proc/mdstat we'll see if everything is ok. The details will show us
mdadm -Db /dev/md/1
Paste the output of this command into /etc/mdadm/mdadm.conf.
And with the last command, we'll update our initramfs
update-initramfs -u
Now we can reboot, and even after rebooting we'll have our newly named /dev/md1 array.
2) Mounting a RAID in fstab using UUID
Suppose now we want to mount this RAID in a folder. In /etc/fstab we can refer to it by name, i.e. /dev/md1. But now it's fashionable to use the UUID of the field, so let's see how to do that.
As I said, there are two different UUIDs. Let's start with what we already know:
root@bell15:~# mdadm --detail /dev/md1 | grep UUID
UUID : becdc1af:2b848157:838b4773:d793cf18
root@bell15:~# grep becdc1af /etc/mdadm/mdadm.conf
ARRAY /dev/md/1 metadata=1.2 UUID=becdc1af:2b848157:838b4773:d793cf18 name=bell15:1
To find the UUID needed for the fstab, do the following:
root@bell15:~# dumpe2fs /dev/md1 | grep UUID
dumpe2fs 1.44.5 (15-Dec-2018)
Filesystem UUID: 296a24a7-6848-42e6-a4e8-312abeae0f53
So the new line in the /etc/fstab looks like this
root@bell15:~# grep 296a24a7 /etc/fstab
UUID=296a24a7-6848-42e6-a4e8-312abeae0f53 /data ext4 defaults 0 2
We'll just test mount it and we're done!