Raid

在raid中啟用新磁碟

  • November 5, 2017

我在一次突襲中有一台帶有 2 個磁碟的伺服器,其中一個失敗了。打電話給供應商,讓他們更換磁碟。

重新啟動後,我仍然只看到一個磁碟:

cat /proc/mdstat 
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] 
md2 : active raid1 sda3[0]
     1073610560 blocks super 1.2 [2/1] [U_]

md3 : active raid1 sda4[0]
     1839089920 blocks super 1.2 [2/1] [U_]

md0 : active raid1 sda1[0]
     16768896 blocks super 1.2 [2/1] [U_]

md1 : active raid1 sda2[0]
     523968 blocks super 1.2 [2/1] [U_]

unused devices: <none>

看起來新驅動器已被刪除:

mdadm -D /dev/md3
/dev/md3:
       Version : 1.2
 Creation Time : Wed Jun 17 00:26:21 2015
    Raid Level : raid1
    Array Size : 1839089920 (1753.89 GiB 1883.23 GB)
 Used Dev Size : 1839089920 (1753.89 GiB 1883.23 GB)
  Raid Devices : 2
 Total Devices : 1
   Persistence : Superblock is persistent

   Update Time : Sun Nov  5 15:56:00 2017
         State : clean, degraded 
Active Devices : 1
Working Devices : 1
Failed Devices : 0
 Spare Devices : 0

          Name : rescue:3
          UUID : 0c807ba7:4535e375:273f715a:7ab59c54
        Events : 2851

   Number   Major   Minor   RaidDevice State
      0       8        4        0      active sync   /dev/sda4
      2       0        0        2      removed

所以問題是如何在 /dev/sdb 中啟用我的新磁碟?當我使用該工具對其進行測試時,它看起來不錯:

smartctl -H /dev/sdb
smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.4.0-98-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

我該如何進行?

先備份重要數據,最好用dd完整分區(沒有程序寫的時候)。你可以使用這樣的東西:

dd if=/dev/md3 of=/your/backup/path/md3.dump bs=1M

所以如果出現問題,你是安全的……

https://www.howtoforge.com/replacing_hard_disks_in_a_raid1_array

引用自:https://serverfault.com/questions/881956