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?
Start with
mdadm --detail /dev/md127
:The first line shows the metadata version used by this array. Now, stop the array:
And assemble it again using the new name. If the metadata version is 1.0 or higher, use this:
For arrays using old metadata structure (most likely 0.90, as it allows for kernel auto-assembly), use this:
I was in a similar position--I had an array I created which was re-named to /dev/md127 after reboot.
The code
mdadm --stop /dev/md127
mdadm --assemble /dev/md3 /dev/sd[cdef]1
was enough to get the md array re-named /dev/md3 for me, but like everyone else, after a reboot, it would revert back to /dev/md127
I found that if I re-assembled the md array back to /dev/md3, and then re-created the initramfs file (
dracut --force
as I am on CentOS), then it would remember my array's name (/dev/md3) after reboots.The other answers work, but if you don't want to stop your array prematurely, see here: How-to change the name of an MD device (mdadm) (from superuser)