Linux: Renaming software RAID
Posted: Fri Apr 18, 2014 3:03 am
[PROBLEM]
One can realize that him/her wants to change the label/name of their Linux SoftRAID, which is already used in production - and should stay like that.
[SOLUTION]
1) Unmount any RAID you want to rename.
2) Stop the RAIDs:
Replace "/dev/mdX" with the RAID device(s) you want to rename.
3) Rename the RAID:
For renaming the RAID of 15 drives in a row of a Backblaze/45drives pod, I did this:
Check if the name was updated with this:
4) Tell the RAID to be writable again:
Without this step, the RAID will be started, but set to "auto-read-only".
5) Update partition/filesystem label:
The "/dev/disk/by-label" for accessing/mounting your RAID devices does not use the MD-RAID names, but the ones of the filesystem.
For XFS, you can update the filesystem label using "xfs_admin -L Name". For example:
After having done that for all affected partitions, you have 2 choices to update the links in "/dev/disk/by-label":
Thanks to:
One can realize that him/her wants to change the label/name of their Linux SoftRAID, which is already used in production - and should stay like that.
[SOLUTION]
1) Unmount any RAID you want to rename.
2) Stop the RAIDs:
Code: Select all
$ sudo mdadm --stop /dev/mdX
3) Rename the RAID:
Code: Select all
$ sudo mdadm --assemble /dev/mdX --name=a_new_name --update=name /dev/disk/disks_of_this_raid
Code: Select all
$ sudo mdadm --assemble /dev/md1 --name=dlp_raid_1 --update=name /dev/disk/by-path/pci-0000\:02\:04.0-scsi-*-part1
Code: Select all
$ sudo mdadm --detail /dev/mdX | grep Name
Without this step, the RAID will be started, but set to "auto-read-only".
Code: Select all
$ sudo mdadm --readwrite /dev/mdX
The "/dev/disk/by-label" for accessing/mounting your RAID devices does not use the MD-RAID names, but the ones of the filesystem.
For XFS, you can update the filesystem label using "xfs_admin -L Name". For example:
Code: Select all
$ sudo xfs_admin -L dlp_raid_1 /dev/md1
- Reboot
- Manually update the symlinks in /dev/disk/by-label to reflect your new name(s)
Thanks to: