如何在没有备用的情况下创建软件 raid5 阵列

Yan*_*ton 6 linux mdadm software-raid

我正在尝试使用 mdadm 创建软件 raid5 阵列:

$ linux # mdadm --create --verbose /dev/md0 --level=5 --raid-devices=4 --spare-devices=0 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 64K
mdadm: array /dev/md0 started.
Run Code Online (Sandbox Code Playgroud)

但是在检查 /proc/mdstat 时

Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sdd1[4] sdc1[2] sdb1[1] sda1[0]
      2930279808 blocks level 5, 64k chunk, algorithm 2 [4/3] [UUU_]
      [>....................]  recovery =  0.3% (2970496/976759936) finish=186.1min speed=87172K/sec

unused devices: <none>
Run Code Online (Sandbox Code Playgroud)

似乎有一个驱动器未激活,因此我检查了阵列的详细信息:

/dev/md0:
        Version : 00.90.03
  Creation Time : Tue Jul 21 16:29:53 2009
     Raid Level : raid5
     Array Size : 2930279808 (2794.53 GiB 3000.61 GB)
  Used Dev Size : 976759936 (931.51 GiB 1000.20 GB)
   Raid Devices : 4
  Total Devices : 4
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Tue Jul 21 16:29:53 2009
          State : clean, degraded, recovering
 Active Devices : 3
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 1

         Layout : left-symmetric
     Chunk Size : 64K

 Rebuild Status : 0% complete

           UUID : ce8b2f40:821d003c:0027688e:a70977ec
         Events : 0.1

    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       1       8       17        1      active sync   /dev/sdb1
       2       8       33        2      active sync   /dev/sdc1
       4       8       49        3      spare rebuilding   /dev/sdd1
Run Code Online (Sandbox Code Playgroud)

并且似乎只有 3 个活动设备,其中一个是备用设备。

只是我,还是这里出了什么问题?

the*_*ive 9

本教程涵盖了使用 mdadm 构建 raid5 阵列。您不能在少于三个设备的情况下使用 raid5。

你说的备用是什么意思?Raid5 旨在提供冗余以在一台设备出现故障时幸免于难。如果它不这样做,那么它就不再是raid5了。


问题编辑后编辑:

   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.
Run Code Online (Sandbox Code Playgroud)

似乎就是这样,mdadm 正在使用备用设备将新阵列设置为降级,然后将备用设备放入以构建阵列。