10

I wonder if there is any possibility to remove the state "faulty" in a RAID 1 if (for example) someone failed the wrong hard disk.

I already searched for answers with Google and found several tutorials with re-creating the array and adding "assume-clean" but I can not do this on a running system. So is it possible to "unfail" a hard disk before it was removed from the raid?

2 Answers 2

11

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
4
  • And this does not work when the only left partition in RAID 1 is broken and can't be resynced. Is there no way to cancel the resync without recreating the whole RAID with a rescue system?
    – thonixx
    Apr 3, 2013 at 7:34
  • Obviously not..
    – thonixx
    Nov 14, 2014 at 10:44
  • Are you saying that you have a RAID-1 with two failed devices? If so, and the second one to be failed was not really faulty, you can recover your data, by mounting the second device on its own, read-only, and dumping the data off it. Then recreate the RAID-1 after replacing any actually faulty devices, and restore your data.
    – MadHatter
    Nov 14, 2014 at 10:50
  • I am saying that I would like to think about having the ability to theoretically readd a previously as failed marked partition to a RAID without having to resync the data.
    – thonixx
    Nov 18, 2014 at 15:19
2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .