Is possible to change an md name while the md is still active? AFAIK is not possible
mdadm -A --update=name --name=ibmlinux-root /dev/md126
ls /dev/md/126_0
/dev/md/126_0
ls /dev/md/ibmlinux-root
error: no such file or directory
Is possible only to stop it, update the name, then reassemble it
mdadm --stop /dev/md126
mdadm -A --update=name --name=ibmlinux-root /dev/md126
now the problem... the /dev/md126 is a root device, mounted on / so is impossbile to umount it.
The best thing is to reboot with live-cd and rename it, then reboot (works, I have did it a lot of times).
But I want a more fast and easy solution, Debian use scripts on this directory
/usr/share/initramfs-tools/scripts/local-premount
my idea is to create a script, rename the md, then after reboot remove the script.
I have create the script
vim /usr/share/initramfs-tools/scripts/local-premount/md
#!/bin/sh -e
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
mdadm --stop /dev/md126
mdadm -A --update=name --name=ibmlinux-root /dev/md126
I make it executable, update initramfs and grub
chmod +x /usr/share/initramfs-tools/scripts/local-premount/md
update-initramfs -cv -k all
update-grub2
I reboot and voilà..has the new name as..127! :(
ls /dev/md/127_0
/dev/md/127_0
ls /dev/md/ibmlinux-root
error: no such file or directory
What I miss? I tried also to put the script in /etc/initramfs-tools/scripts/init-premount/ and nothing change.