Rename a Linux MD Device
Often it may be necessary to change the name of an MD device in Linux. For example, say you are migrating from one RAID array to another. At one point you may have both arrays active, the old and the new. In the end you may wish to remove the old array and just have the new, but reuse the name of the old array.
In this example, md3 is the old array and md4 was created to be the new array. We’ve moved the data over to md4 already and now we want to rename md4 to be md3 from this point forward.
First, remove md3 completely (after dismounting the filesystem):
mdadm --stop /dev/md3 mdadm --remove /dev/md3
Next, dismount the new array (md4) and reassemble as md3:
mdadm --stop /dev/md4 mdadm --assemble /dev/md3 /dev/sd[abcdefghijk]1 --update=name
The magic here is “–update=name” which tells mdadm to update the superblocks which previously contained the name md4 with the new name you have specified.
Be sure to update your /etc/fstab if necessary!