Here: how to tell from /proc/mdstat and mdadm --detail which disk has failed and how much margin the array has left.
/proc/mdstat is the kernel's summary of all arrays (in the Wiki), and you can read it without sudo. The line from the start of the lesson:
| Piece | Meaning |
|---|---|
active raid1 |
the array is running, its level is a mirror |
loop0[0], loop1[1] |
the disks and their numbers in the array |
(F) |
the disk has failed (faulty); (S) means a spare |
[2/1] |
two disks are needed, one works |
[U_] |
the slots in order: U is a working disk, _ an empty slot |
An array that runs without some of its disks is called degraded. The data is intact, but there is no margin left: if loop0 fails too, the whole array is gone.
mdadm --detail (in the Wiki) prints more about the array: the line State : clean, degraded, the Active Devices and Failed Devices counters, and at the bottom a removed slot and the disk faulty /dev/loop1. The kernel also wrote the failure to the journal: Disk failure on loop1, disabling device.
On another server /proc/mdstat shows a RAID 5 array:
md1 : active raid5 sdc[2] sdb[1](F) sda[0]
… [3/2] [U_U]
Which disk needs replacing, and how many more failures can the array survive without data loss?
-
The number in brackets is the disk's slot in the array, not a sign of failure. The failure is marked by
(F)onsdb. -
RAID 5 survives one disk failure, and that failure has already happened:
[3/2]. The next one loses the array. -
The order in the line says nothing about failures. The failed disk is marked
(F), which issdb[1], and the_in[U_U]sits in its slot 1.
The (F) mark is on sdb, and its slot 1 in [U_U] is empty. RAID 5 survives the loss of one disk, and the array already runs on two of three, so there is no margin until the replacement.
Key points
-
In
/proc/mdstatthe(F)mark is the failed disk, and[2/1]says how many disks are needed and how many work. - Degraded means an array without some of its disks: the data is intact, and the next failure may cost all of it.
-
mdadm --detailshows theclean, degradedstate and the table of disks with the failed one.