Linux Labs

Storage / Stage 5 of 12

RAID 1: a disk has failed

Not running Starting usually ~20 s
Leave the lesson

Step 3 of 8 · on a machine · 4 min

The state of an array

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:

text
md0 : active raid1 loop1[1](F) loop0[0]
      130048 blocks super 1.2 [2/1] [U_]
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.

bash
sudo mdadm --detail /dev/md0
sudo journalctl -k -g md0
Check yourself 1 question

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) on sdb.

  • 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 is sdb[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/mdstat the (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 --detail shows the clean, degraded state and the table of disks with the failed one.
Ubuntu 24.04
Loading…