I built a raid 5 array some time ago, but never really tested it. I wanted to figure out if I knew what to do in case a drive failed on me before I started loading them up with important data. This is what I went through to remove a drive, partition a new one and add it to the array.
Removing a Drive
In order to remove a drive, it must be makred as faulty. It may be marked faulty through failure or manually.
To manually mark a drive as faulty you can do it by using the -f/—fail flag, lisk so: sudo mdadm /dev/md0 -f /dev/sdd1
where /dev/md0
is your array and /dev/sdd1
is the drive to be marked faulty.
You can see the drive has been marked as faulty in the array details.
$ sudo mdadm --detail /dev/md0
Number Major Minor RaidDevice State
0 8 97 0 active sync /dev/sdg1
1 0 0 1 removed
3 8 33 2 active sync /dev/sdc1
1 8 17 - faulty spare /dev/sdb1