An administrator has created a RAID 1 array using mdadm with two 1TB disks. After a disk failure, the array is in a degraded state. Which command should be used to replace the failed disk with a new one?
Correct sequence: fail, remove, add.
Why this answer
Option B is correct because it uses the `--manage` subcommand to first mark the failed disk (`/dev/sdb`) as failed with `--fail`, then remove it with `--remove`, and finally add the replacement disk (`/dev/sdc`) with `--add`. This is the proper sequence in mdadm to replace a failed disk in a RAID 1 array while the array is degraded.
Exam trap
The trap here is that candidates often think they can simply add a new disk with `--add` or remove the old disk directly without first marking it as failed, but mdadm requires the explicit `--fail` step to safely replace a failed disk in a degraded array.
How to eliminate wrong answers
Option A is wrong because `mdadm --add /dev/md0 /dev/sdc` attempts to add a new disk without first failing and removing the old failed disk, which can cause conflicts or be rejected by mdadm if the failed disk is still present in the array. Option C is wrong because `mdadm --remove /dev/md0 /dev/sdb --add /dev/sdc` tries to remove a disk without first marking it as failed; mdadm will refuse to remove an active or failed disk without the `--fail` step. Option D is wrong because `mdadm --replace` is not a valid mdadm command; the correct approach uses `--manage` with the `--fail`, `--remove`, and `--add` actions.