HowTo: Linux Rename a RAID Array From md0 to md2

h‮‬ttps://www.lautturi.com
HowTo: Linux Rename a RAID Array From md0 to md2

To rename a RAID array in Linux, you will need to use the mdadm command.

First, stop the RAID array by running the following command:

sudo mdadm --stop /dev/md0

Replace /dev/md0 with the name of your RAID array.

Next, create a new RAID array with the desired name using the --create option. For example, to create a new RAID array named /dev/md2, you can use the following command:

sudo mdadm --create /dev/md2 --level=raid1 --raid-devices=2 /dev/sda1 /dev/sdb1

Replace /dev/sda1 and /dev/sdb1 with the names of the devices that make up the RAID array.

Finally, copy the data from the old RAID array to the new one using the dd command:

sudo dd if=/dev/md0 of=/dev/md2 bs=4M

This will copy the data block by block, using a block size of 4 megabytes. You may need to adjust the block size depending on the size of your array and the speed of your system.

After the data has been copied, you can remove the old RAID array and use the new one in its place.

sudo mdadm --remove /dev/md0

Keep in mind that this process will cause the RAID array to be unavailable while the data is being copied, so you may want to do this during a maintenance window when the system can be taken offline.

Created Time:2017-10-29 22:08:44  Author:lautturi