MegaCli修复RAID5

发布于 2017-10-11  约 6 分钟

背景:IDC异地搬迁,存储用货车拉到新机房上架,很多磁盘本身就坏了或在路上被颠坏,找台换完盘没修复完的机器玩玩~

注意,以下操作尽量在没有IO操作的情况下进行。

1、查看所有磁盘的状态,这没啥好说的

./MegaCli64 -PDList -a0

2、有块盘Firmware state是Unconfigured(bad),这是今天要拯救的目标

Enclosure Device ID: 0
Slot Number: 9
Device Id: 8
Sequence Number: 7
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SATA
Raw Size: 3.638 TB [0x1d1c0beb0 Sectors]
Non Coerced Size: 3.637 TB [0x1d1b0beb0 Sectors]
Coerced Size: 3.637 TB [0x1d1b00000 Sectors]
Firmware state: Unconfigured(bad)
SAS Address(0): 0x5001c4500077d8a9
Connected Port Number: 0(path0) 
Inquiry Data:             手动马赛克
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Foreign State: None 
Device Speed: Unknown 
Link Speed: Unknown 
Media Type: Hard Disk Device

3、先让这块磁盘变成good

./MegaCli64 -PDMakeGood -PhysDrv[0:9] -a0

这里-PhysDrv[0:9]对应上面的Enclosure Device ID和Slot Number,-a肯定是Adapter #0,再看磁盘的状态

Enclosure Device ID: 0
Slot Number: 9
Device Id: 8
Sequence Number: 8
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SATA
Raw Size: 3.638 TB [0x1d1c0beb0 Sectors]
Non Coerced Size: 3.637 TB [0x1d1b0beb0 Sectors]
Coerced Size: 3.637 TB [0x1d1b00000 Sectors]
Firmware state: Unconfigured(good), Spun Up
SAS Address(0): 0x5001c4500077d8a9
Connected Port Number: 0(path0) 
Inquiry Data:             手动马赛克
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Foreign State: Foreign 
Foreign Secure: Drive is not secured by a foreign lock key
Device Speed: Unknown 
Link Speed: Unknown 
Media Type: Hard Disk Device

4、现在看看原来RAID阵列谁掉了,也就是说被换掉的坏盘原来在阵列里的位置

./MegaCli64 -pdgetmissing -a0

    Adapter 0 - Missing Physical drives

    No.   Array   Row   Size Expected
    0     1       0     3814912 MB

Exit Code: 0x00

5、记住是Array 1,Row 0,下面用新盘替换这个位置

./MegaCli64 -PdReplaceMissing -physdrv[0:9] -array1 -row0 -a0   

Adapter: 0: Missing PD at Array 1, Row 0 is replaced.

Exit Code: 0x00

6、可以看到成功了,但是RAID还不能用,我们只是拿一块空盘替换原来装着数据的坏盘,要先恢复数据才行。怎么恢复?RAID5可以通过校验其他盘来恢复坏盘的数据,恢复的过程叫Rebuild。下面先把Rebuild开起来

./MegaCli64 -PDRbld -Start -PhysDrv[0:9] -a0    

Started rebuild progress on device(Encl-0 Slot-9)

Exit Code: 0x00

7、rebuild已经开始了,这个过程非常耗时间,对磁盘IO带来很大压力,所以尽量不要读写数据。我也经历过Rebuild 2天之后没好,反而把其他磁盘搞坏了的倒霉事儿。所以,有这个空去拜个佛烧柱香,成功的概率可能会大一些。怎么知道Rebuild 进度呢?

./MegaCli64 -pdrbld -showprog -physdrv[0:9] -a0   

Rebuild Progress on Device at Enclosure 0, Slot 9 Completed 1% in 6 Minutes.

Exit Code: 0x00

这表示:已经用了6分钟,完成了1% 。。。。照这速度大概10个小时以后能完成,所以下班去拜佛烧香明天上班来看结果还是很科学哒~

阅读 5.9k发布于 2017-10-11

推荐阅读
RAID管理-MegaRAID
用户专栏

RAID管理-MegaRAID

0 人关注
3 篇文章
专栏主页
目录