为什么 RAID 1(Linux 软件 raid)中故障驱动器的替换驱动器被添加为备用驱动器?

为什么 RAID 1(Linux 软件 raid)中故障驱动器的替换驱动器被添加为备用驱动器?

我的服务器有两块硬盘的 Linux 软件 RAID 1。有两个 RAID 设备。(启动 (md0) 和操作系统 (md1))上周其中一个硬盘坏了,所以我订购了一块新的。今天我关闭了服务器,安装了新服务器,然后尝试将新硬盘重新添加到 RAID 中。出于某种原因,它被添加为备用硬盘而不是活动硬盘。

故障驱动器被移除后,阵列的状态如下:

[root@server ~]# mdadm --detail /dev/md0
/dev/md0:
        Version : 1.0
  Creation Time : Mon Nov 25 18:01:08 2013
     Raid Level : raid1
     Array Size : 511936 (500.02 MiB 524.22 MB)
  Used Dev Size : 511936 (500.02 MiB 524.22 MB)
   Raid Devices : 2
  Total Devices : 1
    Persistence : Superblock is persistent

    Update Time : Thu Feb 20 15:19:05 2014
          State : clean, degraded
 Active Devices : 1
Working Devices : 1
 Failed Devices : 0
  Spare Devices : 0

           Name : 0
           UUID : ff06d319:b29fb1b0:7be4fded:5eff1a05
         Events : 372

    Number   Major   Minor   RaidDevice State
       3       8       97        0      active sync   /dev/sdg1
       1       0        0        1      removed
[root@server ~]# mdadm --detail /dev/md1
/dev/md1:
        Version : 1.1
  Creation Time : Mon Nov 25 18:01:09 2013
     Raid Level : raid1
     Array Size : 249414464 (237.86 GiB 255.40 GB)
  Used Dev Size : 249414464 (237.86 GiB 255.40 GB)
   Raid Devices : 2
  Total Devices : 1
    Persistence : Superblock is persistent

  Intent Bitmap : Internal

    Update Time : Thu Feb 20 15:20:22 2014
          State : active, degraded
 Active Devices : 1
Working Devices : 1
 Failed Devices : 0
  Spare Devices : 0

           Name : 1
           UUID : 5141caf1:c7c81553:0f1fa3fa:2ffdf6bd
         Events : 4813017

    Number   Major   Minor   RaidDevice State
       0       8       98        0      active sync   /dev/sdg2
       1       0        0        1      removed

然后我运行了以下命令:

[root@server ~]# sfdisk -d /dev/sdg | sfdisk /dev/sdh --force
[root@server ~]# mdadm --manage /dev/md0 --add /dev/sdh1
mdadm: added /dev/sdh1
[root@server ~]# mdadm --manage /dev/md1 --add /dev/sdh2
mdadm: added /dev/sdh2

我让他们重建,现在我为 MD1 得到了这个。

[root@server ~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdh1[2] sdg1[3]
      511936 blocks super 1.0 [2/2] [UU]

md1 : active raid1 sdh2[2](S) sdg2[0]
      249414464 blocks super 1.1 [2/1] [U_]
      bitmap: 2/2 pages [8KB], 65536KB chunk

更多详细信息:

[root@server ~]#mdadm --detail /dev/md0
/dev/md0:
        Version : 1.0
  Creation Time : Mon Nov 25 18:01:08 2013
     Raid Level : raid1
     Array Size : 511936 (500.02 MiB 524.22 MB)
  Used Dev Size : 511936 (500.02 MiB 524.22 MB)
   Raid Devices : 2
  Total Devices : 2
    Persistence : Superblock is persistent

    Update Time : Thu Feb 20 15:22:51 2014
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           Name : 0
           UUID : ff06d319:b29fb1b0:7be4fded:5eff1a05
         Events : 393

    Number   Major   Minor   RaidDevice State
       3       8       97        0      active sync   /dev/sdg1
       2       8      113        1      active sync   /dev/sdh1
[root@server ~]# mdadm --detail /dev/md1
/dev/md1:
        Version : 1.1
  Creation Time : Mon Nov 25 18:01:09 2013
     Raid Level : raid1
     Array Size : 249414464 (237.86 GiB 255.40 GB)
  Used Dev Size : 249414464 (237.86 GiB 255.40 GB)
   Raid Devices : 2
  Total Devices : 2
    Persistence : Superblock is persistent

  Intent Bitmap : Internal

    Update Time : Thu Feb 20 16:34:34 2014
          State : active, degraded
 Active Devices : 1
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 1

    Number   Major   Minor   RaidDevice State
       0       8       98        0      active sync   /dev/sdg2
       1       0        0        1      removed

       2       8      114        -      spare   /dev/sdh2

有人能告诉我为什么会发生这种情况吗?上次我遇到这种情况时,最终丢失了整个卷。我只想让 MD1 恢复正常运行。

相关内容