Linux – How to rename an mdadm raid array

linuxmdadmraid

I have assembled a new raid array to replace an old one. However, this new array got assigned an automatic name of /dev/md127 and I want to rename it to /dev/md3, so that I don't have to change various other settings. How do I rename an mdadm raid array?

Best Answer

Start with mdadm --detail /dev/md127:

Version : 0.90
Creation Time : Wed Apr 13 20:03:21 2011
Raid Level : raid10
Array Size : 656765952 (626.34 GiB 672.53 GB)
Used Dev Size : 437843968 (417.56 GiB 448.35 GB)
Raid Devices : 3
Total Devices : 2
Preferred Minor : 8
Persistence : Superblock is persistent

The first line shows the metadata version used by this array. Now, stop the array:

mdadm --stop /dev/md127
mdadm --remove /dev/md127

And assemble it again using the new name. If the metadata version is 1.0 or higher, use this:

mdadm --assemble /dev/md3 /dev/sd[abcdefghijk]3 --update=name

For arrays using old metadata structure (most likely 0.90, as it allows for kernel auto-assembly), use this:

mdadm --assemble /dev/md3 --update=super-minor /dev/sd[abcdefghijk]3
Related Topic