Remove "faulty state" in RAID 1
There is no such command in mdadm. If you have set the partition to faulty state, the only way to get it online again is to remove and readd it, e.g.
mdadm --remove /dev/md0 /dev/sdb1
mdadm --add /dev/md0 /dev/sdb1
Faulty state is written in a super-block at the begining of your disk/partition, with other metadata regarding your RAID. Those blocks need to have enough information to rebuild the RAID in case of trouble.
mdadm
has a command to set a disk as faulty, but no one to set it as healthy as you could lose data if ever it's wrong. But they are situations when you would like it. For instance, in home NAS with 2 bays you could decide to use one disk only (to start with). Often, in this situation, those NAS OS create a RAID 1 with just one disk without telling. If later on, for whatever reason, this disk is marked as degraded you are stuck. Even if your disk is healthy. Note: It may happen an OS considered a too slow I/O answer as a degraded disk.
In this case (your SMART data are clean), the only solution is to remove the faulty state flag. But this is really dangerous. You have first to stop your RAID. All disks will be detached, but super-block and data will remain on the disks. To get rid of the super-block, you have to create a new raid with this disk/partition and the --assume-clean
option. This will write a new super-block above the old one but keep the data. Be careful, without this option you may lose all your data and be warned there is always a risk even with it.
So in this particular example, something like:
# Stop the RAID1
mdadm -S /dev/mdX
# Recreate a RAID1 with just one disk keeping the data as is
mdadm --create --assume-clean --level=1 --force --raid-devices=1 /dev/mdX /dev/sdXY
may remove the faulty flag.
By the way, if ever you wonder why not put a second disk and get it sync. The answer is: it's not possible to sync anything with a disk flaged as faulty with mdadm
.