Replacing a faulty disk in a software RAID array on Linux

Setting a disk faulty/failed:

# mdadm --fail /dev/md0 /dev/hdb1

NOTE

DO NOT run this on a raid0 device or you will use your data

Removing a faulty disk from an array:

# mdadm --remove /dev/md0 /dev/hdb1

Clearing any previous raid information on a previously used disk

# mdadm --zero-superblock /dev/hdb1

Adding a disk to an array

# mdadm --add /dev/md0 /dev/hdb1