How do I rename an mdadm raid array?

Solution 1:

You have to give it the name actually with --name= like:

sudo mdadm --assemble /dev/md/alpha --name=newname --update=name /dev/sd[gf]

To have a consistent behavior over reboot you have to use the same name in the --name argument than in the last part of the device. Here it would be : sudo mdadm --assemble /dev/md/alpha --name=alpha --update=name /dev/sd[gf]

See Khassad's post below for a full explanation.

Solution 2:

The way to make Ubuntu persist the name change across boots is to update your initramfs. After updating your array name and mdadm.conf, you need to issue the following command:

sudo update-initramfs -u

The whole process:

sudo mdadm --stop /dev/md125
sudo mdadm --assemble /dev/md/alpha --name=alpha --update=name /dev/sd[fg]
sudo mdadm -Db /dev/md/alpha

The third command should return something like:

ARRAY /dev/md/alpha metadata=1.2 name=omicron:alpha UUID=5b024352:3a940335:233aa23f:5c6b2a1f

Paste the result into /etc/mdadm/mdadm.conf (replacing the old line). Or execute:

sudo mdadm -Db /dev/md/alpha >> /etc/mdadm/mdadm.conf

Next run:

sudo update-initramfs -u

Finally, reboot.

This discussion was useful.