mdadm RAID10 - 更改损坏的磁盘

mdadm RAID10 - 更改损坏的磁盘

今晚我的服务器停止响应 ssh、ping,所以我开车去了服务器机房。服务器没有响应键盘(甚至Ctrl-Alt-Del),屏幕上没有数据(它是黑色的,上面没有符号),所以我决定用机箱上的按钮重新启动他。经过几次尝试启动系统(它启动的次数不超过 GRUB,然后就黑屏了),我打开 BIOS 设置,发现阵列的一个磁盘(软件 mdadm RAID10 中的 4 个磁盘之一)崩溃了。在 BIOS 中是:

SATA Port 1         INTEL SSDSC2CW060A3 (60.0GB)
SATA Port 2         ST1000DM003-1CH162 (1000.2GB)
SATA Port 3         ST1000DM003-1CH162 (1000.2GB)
SATA Port 4         Not Present
SATA Port 5         ST1000DM003-1CH162 (1000.2GB)

我已断开该磁盘的连接,系统已启动,但没有阵列。现在我得到了新的相同磁盘,安装在故障磁盘的位置。但 RAID 10 不会自动重建(正如我所想的那样)。启动时我看到

The disk drive for UUID=a3462d0b-7261-48da-8e13-6de332e4de33 is not ready yet or not present
keys:Continue to wait, or Press S to skip mounting or M for manual recovery

The disk drive for /var/log is not ready yet or not present
keys:Continue to wait, or Press S to skip mounting or M for manual recovery

The disk drive for /mnt/vm is not ready yet or not present
keys:Continue to wait, or Press S to skip mounting or M for manual recovery 

/etc/mdadm/mdadm.conf

CREATE owner=root group=disk mode=0660 auto=yes
HOMEHOST <system>
MAILADDR root
ARRAY /dev/md/0 metadata=1.2 name=rockshock:0 UUID=02f2f445:de9ba929:f6a3e9da:249f8e42

/etc/fstab

UUID=6760d8f4-2816-4b54-8938-ab11b329705b /               ext4    noatime,errors=remount-ro 0       1
UUID=7593-A7EC  /boot/efi       vfat    defaults        0       1
UUID=a3462d0b-7261-48da-8e13-6de332e4de33   none    swap    sw  0   0

/dev/raid/logs  /var/log    ext4    noatime,noexec  0   2
/dev/raid/vm    /mnt/vm     ext4    noatime,noexec  0   2

这是我拥有的一些数据(我还应该提供更多吗?):

$ 猫 /proc/mdstat

Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
md0 : inactive sdb[3](S) sdd[0](S) sde[1](S)
   2929894536 blocks super 1.2

unused devices: <none>

$ 块

/dev/sdb: UUID="02f2f445-de9b-a929-f6a3-e9da249f8e42" UUID_SUB="917412df-140c-dbc6-68ad-57e981cbcff9" LABEL="rockshock:0" TYPE="linux_raid_member" 
/dev/sdc1: UUID="7593-A7EC" TYPE="vfat" 
/dev/sdc2: UUID="6760d8f4-2816-4b54-8938-ab11b329705b" TYPE="ext4" 
/dev/sdd: UUID="02f2f445-de9b-a929-f6a3-e9da249f8e42" UUID_SUB="0904482c-1a9a-1174-6936-805c8a466493" LABEL="rockshock:0" TYPE="linux_raid_member" 
/dev/sde: UUID="02f2f445-de9b-a929-f6a3-e9da249f8e42" UUID_SUB="9badcfe0-f4a4-cd0c-baa8-3d4ebc46c56e" LABEL="rockshock:0" TYPE="linux_raid_member" 

$ sudo mdadm --detail /dev/md0

mdadm: md device /dev/md0 does not appear to be active.

$ sudo mdadm --检查 --scan -v

ARRAY /dev/md/0 level=raid10 metadata=1.2 num-devices=4 UUID=02f2f445:de9ba929:f6a3e9da:249f8e42 name=rockshock:0
   devices=/dev/sde,/dev/sdd,/dev/sdb

$ sudo mdadm --检查 /dev/sd[abde]

 /dev/sdb:
         Magic : a92b4efc
       Version : 1.2
   Feature Map : 0x0
    Array UUID : 02f2f445:de9ba929:f6a3e9da:249f8e42
          Name : rockshock:0  (local to host rockshock)
 Creation Time : Wed Jan  1 16:40:06 2014
    Raid Level : raid10
  Raid Devices : 4

Avail Dev Size : 1953263024 (931.39 GiB 1000.07 GB)
    Array Size : 1953262592 (1862.78 GiB 2000.14 GB)
 Used Dev Size : 1953262592 (931.39 GiB 1000.07 GB)
   Data Offset : 262144 sectors
  Super Offset : 8 sectors
         State : clean
   Device UUID : 917412df:140cdbc6:68ad57e9:81cbcff9

   Update Time : Sat Jul 25 04:18:34 2015
      Checksum : 1f73fe53 - correct
        Events : 727

        Layout : near=2
    Chunk Size : 512K

   Device Role : Active device 3
   Array State : AAAA ('A' == active, '.' == missing)

 /dev/sdd:
         Magic : a92b4efc
       Version : 1.2
   Feature Map : 0x0
    Array UUID : 02f2f445:de9ba929:f6a3e9da:249f8e42
          Name : rockshock:0  (local to host rockshock)
 Creation Time : Wed Jan  1 16:40:06 2014
    Raid Level : raid10
  Raid Devices : 4

Avail Dev Size : 1953263024 (931.39 GiB 1000.07 GB)
    Array Size : 1953262592 (1862.78 GiB 2000.14 GB)
 Used Dev Size : 1953262592 (931.39 GiB 1000.07 GB)
   Data Offset : 262144 sectors
  Super Offset : 8 sectors
         State : clean
   Device UUID : 0904482c:1a9a1174:6936805c:8a466493

   Update Time : Sat Jul 25 04:25:38 2015
      Checksum : 269e217e - correct
        Events : 731

        Layout : near=2
    Chunk Size : 512K

   Device Role : Active device 0
   Array State : AA.A ('A' == active, '.' == missing)

 /dev/sde:
         Magic : a92b4efc
       Version : 1.2
   Feature Map : 0x0
    Array UUID : 02f2f445:de9ba929:f6a3e9da:249f8e42
          Name : rockshock:0  (local to host rockshock)
 Creation Time : Wed Jan  1 16:40:06 2014
    Raid Level : raid10
  Raid Devices : 4

Avail Dev Size : 1953263024 (931.39 GiB 1000.07 GB)
    Array Size : 1953262592 (1862.78 GiB 2000.14 GB)

    Raid Level : raid10
  Raid Devices : 4

Avail Dev Size : 1953263024 (931.39 GiB 1000.07 GB)
    Array Size : 1953262592 (1862.78 GiB 2000.14 GB)
 Used Dev Size : 1953262592 (931.39 GiB 1000.07 GB)
   Data Offset : 262144 sectors
  Super Offset : 8 sectors
         State : clean
   Device UUID : 9badcfe0:f4a4cd0c:baa83d4e:bc46c56e

   Update Time : Sat Jul 25 04:25:38 2015
      Checksum : 4100486e - correct
        Events : 731

        Layout : near=2
    Chunk Size : 512K

   Device Role : Active device 1
   Array State : AA.A ('A' == active, '.' == missing)

$ sudo fdisk -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00092197

   Device Boot      Start         End      Blocks   Id  System
Disk /dev/sdc: 60.0 GB, 60022480896 bytes
255 heads, 63 sectors/track, 7297 cylinders, total 117231408 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

  Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1   117231407    58615703+  ee  GPT

Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0003765c

  Device Boot      Start         End      Blocks   Id  System

Disk /dev/sde: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000ca97d

  Device Boot      Start         End      Blocks   Id  System

/dev/sdc1               1   117231407    58615703+  ee  GPT

Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0003765c

  Device Boot      Start         End      Blocks   Id  System

Disk /dev/sde: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000ca97d

  Device Boot      Start         End      Blocks   Id  System

所以我问有 mdadm 经验的人:让我转向正确的方向,在这种情况下我应该做什么。

  1. 我可以在做某事之前从数组中获取数据吗? ()
  2. 出于什么原因“mdadm --detail /dev/md0”告诉我 md0 未激活?这是 RAID10 的正常行为吗?
  3. 如何对 mdadm 说忘记阵列中的旧磁盘而不是逻辑名称?
  4. 如何正确添加新磁盘来替换阵列中出现故障的磁盘?

谢谢。

答案1

/dev/sdb: 活动 : 727

/dev/sdd: 活动 : 731

/dev/sde: 活动 : 731

看起来您有两个驱动器发生故障:/dev/sdb在 04:18:34 左右发生暂时性故障并从阵列中删除,然后/dev/sdc在 04:25:38 左右发生故障,导致整个阵列冻结。由于 的事件计数/dev/sdb低于 和 的/dev/sdd事件计数/dev/sdemdadm因此在启动阵列时不会将其包括在内,并且剩余的两个磁盘不足以形成完整的 RAID 10 阵列(推测它们是彼此的镜像)。

用于恢复故障阵列的 Linux RAID wiki 过程应该适用于 RAID 10,就像适用于 RAID 5/6 一样。关键步骤是mdadm使用标志告诉忽略事件计数不匹配--force;该过程其余部分的目的是提前查明这样做是否会恢复或销毁您的数据。

相关内容