Renaming RAID Devices
I learned recently that software RAID devices under Linux can have friendly names. I had never specified a name when creating arrays.
I’ve been recently updating my fileserver to RHEL 8 and working with the original array I created in 2015 and documented in my post: RAID 6 and LVM. In the original version of that post, I did not specify a name.
I’ve found that naming my RAID volumes has a great benefit when reinstalling the system via Kickstart, which I’ll write about more in detail later.
So, my RAID volumes are unnamed….how do I give them a name?
First, let’s look at our RAID volume using the mdadm --detail
command:
# mdadm --detail /dev/md200
/dev/md200:
Version : 1.2
Creation Time : Thu Sep 24 17:47:54 2015
Raid Level : raid6
Array Size : 3906521088 (3.64 TiB 4.00 TB)
Used Dev Size : 976630272 (931.39 GiB 1000.07 GB)
Raid Devices : 6
Total Devices : 6
Persistence : Superblock is persistent
Intent Bitmap : Internal
Update Time : Thu Jun 9 03:11:45 2022
State : clean
Active Devices : 6
Working Devices : 6
Failed Devices : 0
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 512K
Consistency Policy : bitmap
Name : 200
UUID : 6d90c19a:9812e659:6854747b:a89f1280
Events : 34710
Number Major Minor RaidDevice State
0 8 97 0 active sync /dev/sdg1
1 8 17 1 active sync /dev/sdb1
2 8 49 2 active sync /dev/sdd1
3 8 113 3 active sync /dev/sdh1
4 8 65 4 active sync /dev/sde1
5 8 81 5 active sync /dev/sdf1
Above, there is a name field, but it’s not really a human name, just
200
. This is really just the /dev/md###
number.
Renaming is a relatively simple operation, but it can’t be done live.
In my setup, I have a LVM Volume Group called galadriel
. I want to
rename my RAID device to also be galadriel
to match.
-
Run
mdadm --detail
and save the output somewhere for reference. -
Unmount all volumes related to either the RAID device or volume group using the RAID.
-
Stop the volume group.
-a n
deactivates the volume group.vgchange -a n galadriel
-
Stop the md device using
mdadm
sudo mdadm --stop /dev/md200
-
Reassemble with new name. This reassembles the drive with the
--name
. The device names can be gleaned from the output of `mdadm –detail.sudo mdadm --assemble --update=name --name=galadriel /dev/md200 /dev/sdg1 /dev/sdb1 /dev/sdd1 /dev/sdh1 /dev/sde1 /dev/sdf1
-
Reactivate the volume group
vgchange -a y galadriel
-
Check that everthing is OK, by looking at
/dev/mdstat
, comparing new output ofmdadm --detail
,vgs
, andlvs
.# cat /proc/mdstat md200 : active raid6 sdf1[1] sdh1[2] sdd1[3] sda1[4] sdc1[0] sdb1[5] 3906521088 blocks super 1.2 level 6, 512k chunk, algorithm 2 [6/6] [UUUUUU] bitmap: 0/8 pages [0KB], 65536KB chunk
-
It may be required to update
/etc/mdadm.conf
. In RHEL7+, the UUID is used, so only the dev path may need to be updated:# cat /etc/mdadm.conf ### Snippet of relevant line: ARRAY /dev/md/galadriel level=raid6 num-devices=6 UUID=6d90c19a:9812e659:6854747b:a89f1280