mdadm remove faulty spare

The following mdadm command will remove a faulty spare drive from your RAID device,


bash$ mdadm -D /dev/md0
/dev/md0:
...
...
Number   Major   Minor   RaidDevice State
0       8       17        0      active sync   /dev/sdb1
1       8       48        1      active sync   /dev/sdd
2       8        1        2      active sync   /dev/sda1
3       8       32        3      active sync   /dev/sdc
4       8       97        -      spare   /dev/sdg1
5       8       65        -      faulty spare


bash$ mdadm /dev/md0 --remove detached
mdadm: hot removed 8:65

bash$ mdadm -D /dev/md0
/dev/md0:
...
...
Number   Major   Minor   RaidDevice State
0       8       17        0      active sync   /dev/sdb1
1       8       48        1      active sync   /dev/sdd
2       8        1        2      active sync   /dev/sda1
3       8       32        3      active sync   /dev/sdc
4       8       97        -      spare   /dev/sdg1

And the faulty spare has disappeared.