如何使用 mdadm 将额外的镜像驱动器添加到现有的 raid 阵列?

如何使用 mdadm 将额外的镜像驱动器添加到现有的 raid 阵列?

我创建了一个数组:

mdadm --create --verbose /dev/md3 --level=mirror --raid-devices=2 /dev/sdc1 /dev/sdd1

以上已经成功完成。

现在我想添加一个额外的驱动器以得到 3 个相同的镜子。所以根据这里的信息https://raid.wiki.kernel.org/index.php/A_guide_to_mdadm#Adding_a_drive_to_a_mirror我跑:

sudo mdadm --grow /dev/md127 --add /dev/sda --raid-devices=3
mdadm: added /dev/sda
raid_disks for /dev/md127 set to 3

然而,看看诊断:

sudo mdadm -D /dev/md127
/dev/md127:
           Version : 1.2
     Creation Time : Wed May 20 18:06:31 2020
        Raid Level : raid1
        Array Size : 2928507904 (2792.84 GiB 2998.79 GB)
     Used Dev Size : 2928507904 (2792.84 GiB 2998.79 GB)
      Raid Devices : 3
     Total Devices : 3
       Persistence : Superblock is persistent

     Intent Bitmap : Internal

       Update Time : Thu May 28 14:44:52 2020
             State : clean, degraded, recovering 
    Active Devices : 2
   Working Devices : 3
    Failed Devices : 0
     Spare Devices : 1

Consistency Policy : bitmap

    Rebuild Status : 0% complete

              Name : blueberry:3  (local to host blueberry)
              UUID : 3cfe6a05:7fbfe9c6:0249d666:1a23a6aa
            Events : 5468

    Number   Major   Minor   RaidDevice State
       0       8       17        0      active sync   /dev/sdb1
       1       8       33        1      active sync   /dev/sdc1
       2       8        0        2      spare rebuilding   /dev/sda
cat /proc/mdstat 
Personalities : [raid1] 
md127 : active raid1 sda[2] sdc1[1] sdb1[0]
      2928507904 blocks super 1.2 [3/2] [UU_]
      [>....................]  recovery =  3.1% (92780288/2928507904) finish=336.6min speed=140405K/sec
      bitmap: 0/22 pages [0KB], 65536KB chunk

unused devices: <none>

看来这个驱动器已被添加为spare替代?但奇怪的是它会这样做吗rebuild

答案1

最终这似乎是正确的。

最终输出为:

cat /proc/mdstat 
Personalities : [raid1] 
md127 : active raid1 sda[2] sdc1[1] sdb1[0]
      2928507904 blocks super 1.2 [3/3] [UUU]
      bitmap: 0/22 pages [0KB], 65536KB chunk

unused devices: <none>
sudo mdadm -D /dev/md127
/dev/md127:
           Version : 1.2
     Creation Time : Wed May 20 18:06:31 2020
        Raid Level : raid1
        Array Size : 2928507904 (2792.84 GiB 2998.79 GB)
     Used Dev Size : 2928507904 (2792.84 GiB 2998.79 GB)
      Raid Devices : 3
     Total Devices : 3
       Persistence : Superblock is persistent

     Intent Bitmap : Internal

       Update Time : Thu May 28 22:22:04 2020
             State : clean 
    Active Devices : 3
   Working Devices : 3
    Failed Devices : 0
     Spare Devices : 0

Consistency Policy : bitmap

              Name : blueberry:3  (local to host blueberry)
              UUID : 3cfe6a05:7fbfe9c6:0249d666:1a23a6aa
            Events : 11028

    Number   Major   Minor   RaidDevice State
       0       8       17        0      active sync   /dev/sdb1
       1       8       33        1      active sync   /dev/sdc1
       2       8        0        2      active sync   /dev/sda

相关内容