Linux – get a DegradedArray event with mdadm

linuxmdadmraidraid5software-raid

Just so we're clear on what's happening:

  • I bought 4 new sata 2 drives, with the intent of using them in a raid5
  • all drive are fully recognised by both my bios and my linux box (gentoo)
  • I created a raid5 array, fiddled a bit with it to understand how it works, how to monitor, etc.
  • At some point, this triggered a degradedarray event, even though the array is brand new. I tried to stopping the array and recreating a new array with the same drive but the new array starts degraded too.

Here is what I used to create it:

mdadm --create -l5 -n4 /dev/md/md0-r5 /dev/sdb /dev/sdd /dev/sde /dev/sdf

Here are the output from my /proc/mdstat and mdadm --detail --scan:

**mdstat**

Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md127 : active raid5 sdf[4] sde[2] sdd[1] sdb[0]
      4395415488 blocks level 5, 64k chunk, algorithm 2 [4/3] [UUU_]
      [>....................]  recovery =  2.8% (41689732/1465138496) finish=890.3min speed=26645K/sec

unused devices: <none>

**detail**

ARRAY /dev/md/md0-r5 metadata=0.90 spares=1 UUID=453e2833:81f22a74:64188b84:66721085

As such I have a couple questions:

  • does a raid5 array always start in degraded mode at first ?
  • why does sdf have the number 4 between bracket instead of 3, why does it see a spare disk and why is the 4th drive marked with _ instead of U ? (bad configuration ?)
  • How can I recreate the array from scratch, do i have to format each drive on its own before recreating it ?

Thanks for any help, I'm not sure about what I should do at the moment.

Best Answer

  • does a raid5 array always start in degraded mode at first ?

Yes. At least, it always has for me. It makes sense; for any one of the disks to be able to fail, the disks must be synced. This will involve writing an equivalent of one whole disk's worth of data, which will take a while. Until this has been completed, the array is seen as "degraded".

Update: From the mdadm manual:

When creating a RAID5 array, mdadm will automatically create a degraded array with an extra spare drive. This is because building the spare into a degraded array is in general faster than resyncing the parity on a non-degraded, but not clean, array. This feature can be overridden with the --force option.