2013-06-04 08:15:37 +0000 2013-06-04 08:15:37 +0000
22
22

如何重新激活MDADM RAID5阵列?

我刚刚搬了家,这涉及到拆卸我的服务器并重新连接它。在这样做之后,我的一个MDADM RAID5阵列显示为非活动状态:

root@mserver:/tmp# cat /proc/mdstat 
Personalities : [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid1] [raid10] 
md1 : active raid5 sdc1[1] sdh1[2] sdg1[0]
      3907023872 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]

md0 : inactive sdd1[0](S) sdf1[3](S) sde1[2](S) sdb1[1](S)
      3907039744 blocks

unused devices: <none>

在我看来,它似乎找到了所有的磁盘,但出于某种原因不想使用它们。

那么这些(S)标签是什么意思呢,我怎样才能告诉MDADM重新开始使用磁盘阵列呢?

[编辑]我刚刚尝试用-v停止并组装数组。

root@mserver:~# mdadm --stop /dev/md0
mdadm: stopped /dev/md0

root@mserver:~# mdadm --assemble --scan -v
mdadm: /dev/sde1 is identified as a member of /dev/md0, slot 2.
mdadm: /dev/sdf1 is identified as a member of /dev/md0, slot 3.
mdadm: /dev/sdd1 is identified as a member of /dev/md0, slot 0.
mdadm: /dev/sdb1 is identified as a member of /dev/md0, slot 1.
mdadm: added /dev/sdd1 to /dev/md0 as 0 (possibly out of date)
mdadm: added /dev/sdb1 to /dev/md0 as 1 (possibly out of date)
mdadm: added /dev/sdf1 to /dev/md0 as 3 (possibly out of date)
mdadm: added /dev/sde1 to /dev/md0 as 2
mdadm: /dev/md0 assembled from 1 drive - not enough to start the array.

…输入猫/proc/mdstat看起来没有什么不同。

[编辑2]不知道是否有帮助,但这是检查每个磁盘的结果。

root@mserver:~# mdadm –examine /dev/sdb1

/dev/sdb1:
          Magic : a92b4efc
        Version : 0.90.00
           UUID : 2f331560:fc85feff:5457a8c1:6e047c67 (local to host mserver)
  Creation Time : Sun Feb 1 20:53:39 2009
     Raid Level : raid5
  Used Dev Size : 976759936 (931.51 GiB 1000.20 GB)
     Array Size : 2930279808 (2794.53 GiB 3000.61 GB)
   Raid Devices : 4
  Total Devices : 4
Preferred Minor : 0

    Update Time : Sat Apr 20 13:22:27 2013
          State : clean
 Active Devices : 4
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 0
       Checksum : 6c8f71a3 - correct
         Events : 955190

         Layout : left-symmetric
     Chunk Size : 64K

      Number Major Minor RaidDevice State
this 1 8 17 1 active sync /dev/sdb1

   0 0 8 113 0 active sync /dev/sdh1
   1 1 8 17 1 active sync /dev/sdb1
   2 2 8 97 2 active sync /dev/sdg1
   3 3 8 33 3 active sync /dev/sdc1

root@mserver:~# mdadm –examine /dev/sdd1

/dev/sdd1:
          Magic : a92b4efc
        Version : 0.90.00
           UUID : 2f331560:fc85feff:5457a8c1:6e047c67 (local to host mserver)
  Creation Time : Sun Feb 1 20:53:39 2009
     Raid Level : raid5
  Used Dev Size : 976759936 (931.51 GiB 1000.20 GB)
     Array Size : 2930279808 (2794.53 GiB 3000.61 GB)
   Raid Devices : 4
  Total Devices : 2
Preferred Minor : 0

    Update Time : Sat Apr 20 18:37:23 2013
          State : active
 Active Devices : 2
Working Devices : 2
 Failed Devices : 2
  Spare Devices : 0
       Checksum : 6c812869 - correct
         Events : 955205

         Layout : left-symmetric
     Chunk Size : 64K

      Number Major Minor RaidDevice State
this 0 8 113 0 active sync /dev/sdh1

   0 0 8 113 0 active sync /dev/sdh1
   1 1 0 0 1 faulty removed
   2 2 8 97 2 active sync /dev/sdg1
   3 3 0 0 3 faulty removed

root@mserver: ~# mdadm –examine /dev/sde1

/dev/sde1:
          Magic : a92b4efc
        Version : 0.90.00
           UUID : 2f331560:fc85feff:5457a8c1:6e047c67 (local to host mserver)
  Creation Time : Sun Feb 1 20:53:39 2009
     Raid Level : raid5
  Used Dev Size : 976759936 (931.51 GiB 1000.20 GB)
     Array Size : 2930279808 (2794.53 GiB 3000.61 GB)
   Raid Devices : 4
  Total Devices : 2
Preferred Minor : 0

    Update Time : Sun Apr 21 14:00:43 2013
          State : clean
 Active Devices : 1
Working Devices : 1
 Failed Devices : 2
  Spare Devices : 0
       Checksum : 6c90cc70 - correct
         Events : 955219

         Layout : left-symmetric
     Chunk Size : 64K

      Number Major Minor RaidDevice State
this 2 8 97 2 active sync /dev/sdg1

   0 0 0 0 0 removed
   1 1 0 0 1 faulty removed
   2 2 8 97 2 active sync /dev/sdg1
   3 3 0 0 3 faulty removed

root@mserver:~# mdadm –examine /dev/sdf1

/dev/sdf1:
          Magic : a92b4efc
        Version : 0.90.00
           UUID : 2f331560:fc85feff:5457a8c1:6e047c67 (local to host mserver)
  Creation Time : Sun Feb 1 20:53:39 2009
     Raid Level : raid5
  Used Dev Size : 976759936 (931.51 GiB 1000.20 GB)
     Array Size : 2930279808 (2794.53 GiB 3000.61 GB)
   Raid Devices : 4
  Total Devices : 4
Preferred Minor : 0

    Update Time : Sat Apr 20 13:22:27 2013
          State : clean
 Active Devices : 4
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 0
       Checksum : 6c8f71b7 - correct
         Events : 955190

         Layout : left-symmetric
     Chunk Size : 64K

      Number Major Minor RaidDevice State
this 3 8 33 3 active sync /dev/sdc1

   0 0 8 113 0 active sync /dev/sdh1
   1 1 8 17 1 active sync /dev/sdb1
   2 2 8 97 2 active sync /dev/sdg1
   3 3 8 33 3 active sync /dev/sdc1

我有一些笔记,表明硬盘最初的组装情况如下。

md0 : active raid5 sdb1[1] sdc1[3] sdh1[0] sdg1[2]
      2930279808 blocks level 5, 64k chunk, algorithm 2 [4/4] [UUUU]

[编辑3]

通过查看日志,似乎发生了以下情况(根据Update Time结果中的--examine):

  1. sdb和sdf在20日13:22之后的某个时间被淘汰,
  2. sdd在20日18:37之后的某个时间被淘汰,
  3. 服务器在第1次

14:00之后的某个时间被关闭,鉴于两块磁盘同时宕机(显然),我想应该可以合理安全地假设阵列在那之后不会被写入(?用什么命令最安全,有没有办法在不写任何变化的情况下做到这一点?

答案 (3)

28
28
28
2013-06-04 09:14:49 +0000

S标签意味着磁盘被视为 “备用"。你应该尝试停止并重新启动磁盘阵列。

mdadm --stop /dev/md0
  mdadm --assemble --scan

来重新组装磁盘阵列,如果不行的话,你可能需要更新你的mdadm.conf,请参考这个问题来了解详细的操作方法。

9
9
9
2014-09-13 01:33:49 +0000

这个问题有点老了,但答案可能会帮助面临类似情况的人。从你提供的mdadm –examine输出的事件数来看,它们似乎已经很接近了(955190 –对于sdb1和sdf1,955219对于sde1,对于sdd1你已经得到了955205)。如果它们低于40-50,这是正常的,在这种情况下,建议的做法是手动组装你的磁盘阵列,迫使mdadm接受这些驱动器,尽管事件数不同。

停止阵列。

mdadm --stop /dev/md0

然后尝试手动重新组装磁盘阵列:

mdadm --assemble --force /dev/md0 /dev/sdb1 /dev/sdd1 /dev/sde1 /dev/sdf1

检查磁盘阵列的状态,检查硬盘列表/结构是否正常(命令输出的底部会显示哪个硬盘在阵列中处于什么状态和哪个位置)。

mdadm --detail /dev/md0

如果结构正常,检查重建进度。

cat /proc/mdstat
``` 如果结构正常,检查重建进度: 

0x1&
0
0
0
2013-06-04 09:02:31 +0000

你可以用下面的命令

mdadm -A /dev/md0

激活Raid md0,再用这个命令更新mdadm.conf文件

mdadm --examine --scan >> /etc/mdadm/mdadm.conf
```。