标签归档:megacli

megacli查看硬盘状态

通过megacli的如下命令查看RAID的情况,命令如下:

/opt/MegaRAID/MegaCli/MegaCli64 LDPDInfo -Aall

重点关注以下几点:

Media Error Count
Other Error Count
Predictive Failure Count
Last Predictive Failure
Drive has flagged a S.M.A.R.T alert

如果这几个数值不为0,则可能为硬盘故障,需要更换硬盘。

可以通过让指定硬盘闪烁的方式来定位磁盘位置,命令如下:

MegaCli -PdLocate -start -physdrv [E:S] -aALL

其中 E表示 Enclosure Device ID,S表示Slot Number。比如坏盘的位置为:
Enclosure Device ID: 1
Slot Number: 0

可执行以下命令让其闪烁:
root@Storage-c2:/opt/MegaRAID/MegaCli# ./MegaCli64 -PdLocate -start -physdrv[1:0] -a0
Adapter: 0: Device at EnclId-1 SlotId-0 — PD Locate Start Command was successfully sent to Firmware Exit Code: 0x00
root@Storage-c2:/opt/MegaRAID/MegaCli#

更换硬盘后,关闭闪烁的命令如下:
MegaCli -PdLocate -stop -physdrv [E:S] -aALL

如果raid中有硬盘故障,更换硬盘后,一般都无需做操作,阵列卡会自动做rebuild,从拔出硬盘到插入新盘,一般会有以下的过程:

  • Device
    Normal —>Damage —>Rebuild —>Normal
  • Virtual Drive
    Optimal —>Degraded —>Degraded —>Optimal
  • Physical Drive
    Online —>Failed Unconfigured —>Rebuild —>Online

查看rebuild进度的命令如下:

/opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -showprog -physDrv [1:0] -a0

输出一般如下:

root@Storage-c2:/opt/MegaRAID/MegaCli# ./MegaCli64 -PDRbld -showprog -physDrv [1:0] -a0
Rebuild Progress on Device at Enclosure 1, Slot 0 Completed 10% in 0 Minutes.
Exit Code: 0x00
root@Storage-c2:/opt/MegaRAID/MegaCli#