Converting From RAID 1 To RAID 5
I have been playing around with a Linux server in my home lab and wanted to try expanding a Linux software RAID 1 array to a 3 disk RAID 5 array.
So I already have a two disk RAID 1 array with a pair of 1TB SATA drives at /dev/sdb and /dev/sdc. I am going to add a third drive at /dev/sdd to the array.
I start by removing the array description from /etc/mdadm.conf
I also comment out the line from the /etc/fstab
Next I stop the array with
# mdadm --stop /dev/md0
I also unmount that drive
# umount /mnt/vg001/lvol1
Next I change the array configuration to RAID 5
# mdadm --create /dev/md0 --level=5 -n 2 /dev/sdb /dev/sdc
At this point it says that the drives are already part of an array and asks if you really want to do this. Answer Y.
This part takes a little while so go find something else to do while it reconfigures the array.
Once it is done, I add the third drive to the array.
# mdadm --add /dev/md0 /dev/sdd
Now it is time to grow the array
# mdadm --grow /dev/md0 --raid-disks=3 --backup-file=/tmp/raid.backup
I started this 24 hours ago and it is only at 43% complete at this point and it is estimating that it will be another 100+ hours before it completes. Wow. So it works, just painfully slowly.
What I take way from this is if you need to add more space to your array and you are using Linux software RAID, put all your data on another device and build a brand new array, move your data back. It would take less time to move all the data than it would be to wait for the array to grow.
**UPDATE**
I checked in the morning and the grow had completed. So it took between 24 and 33 hours to complete the grow.