Linux Labs

Storage / Stage 5 of 12

RAID 1: a disk has failed

Not running Starting usually ~20 s
Leave the lesson

Step 1 of 8 · on a machine · 4 min

A mirror on one disk

What you will learn

  • Read the state of an array from /proc/mdstat and mdadm --detail and find the failed disk.
  • Replace a failed disk in a mirror with mdadm --remove and --add and follow the rebuild.
  • Build a mirror and record it in mdadm.conf so that it comes back under its own name after a reboot.

The orders on the server live on a mirror, an array of two disks. At night monitoring sent an e-mail about a failed disk, yet the application runs as usual. A colleague asks you to look at the array and check that the files are intact.

Exercise · look

Look at the array and the files

Look at the array summary with cat /proc/mdstat, then at the files in /srv/data/orders and the space in /srv/data.

First, predict

One of the array's two disks has failed. What will ls -l /srv/data/orders show?

Now start the exercise, run the command and compare your prediction with the output.

Sign in and start The machine is available after signing in
Check yourself 1 question

Why can the files in /srv/data be read even though a disk of the array has failed?

  • loop2 is not part of the array: the md0 line does not list it, and lsblk shows no md0 under it.

  • The kernel has already noticed: loop1 carries the (F) mark in /proc/mdstat, and the array runs with [2/1].

  • The cache has nothing to do with it: after sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches', ls -l /srv/data/orders shows the same files.

The array reads the data from the remaining working disk, loop0.

Ubuntu 24.04
Loading…