安装megacli:[[email protected] ~]# rpm -ivh MegaCli-8.07.07-1.noarch.rpm
megacli程序自动安装到/opt/MegaRAID/MegaCli目录下。
注:开机自检时,使用ctrl+y也可直接进入命令行配置界面。ctrl+y进入命令行后需要区分大小写,系统下megacli不需要区分大小写。
1、使用./MegaCli64 –help或者./Megacli64 –h查看命令帮助
2、查看硬盘列表
[[email protected] MegaCli]# ./MegaCli64 -PDList -aALL
其中:Enclosure Device ID: 252----背板
Slot Number: 0-----硬盘位置
Firmware state: Unconfigured(good), Spun Up---显示硬盘状态,单独硬盘还是raid中,Firmware state: Online, Spun Up(raid中)
3、查看raid状态
[[email protected] MegaCli]# ./MegaCli64 -ldinfo -lall -a0 | more
Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name :
RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0
Size : 2.728 TB
Sector Size : 512
Is VD emulated : No
Mirror Data : 2.728 TB
State : Optimal
Strip Size : 256 KB
Number Of Drives : 2
Span Depth : 1
Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy : Disk‘s Default
Encryption Type : None
PI type: No PI
Is VD Cached: No
Virtual Drive: 1 (Target Id: 1)
Name :
RAID Level : Primary-5, Secondary-0, RAID Level Qualifier-3
Size : 24.556 TB
Sector Size : 512
Is VD emulated : No
Parity Size : 2.728 TB
State : Optimal
Strip Size : 256 KB
Number Of Drives : 10
Span Depth : 1
Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy : Disk‘s Default
Encryption Type : None
PI type: No PI
Is VD Cached: No
Exit Code: 0x00
分别查看:[[email protected]-23 MegaCli]# ./MegaCli64 -ldinfo -l0 -a0
[[email protected] MegaCli]# ./MegaCli64 -ldinfo -l1 -a0
查看Raid状态以及raid中包含哪些硬盘:
[[email protected] MegaCli]# ./MegaCli64 -ldpdinfo -a0
Adapter #0
Number of Virtual Disks: 2
Virtual Drive: 0 (Target Id: 0)
……………………………………………………#第一块Virtual Drive
Is VD Cached: No
Number of Spans: 1
Span: 0 - Number of PDs: 2
PD: 0 Information
………………………………
PD: 1 Information
……………………………
Virtual Drive: 1 (Target Id: 1)
………………………………………………#第二块Virtual Drive
Is VD Cached: No
Number of Spans: 1
Span: 0 - Number of PDs: 10
PD: 0 Information
………………………………
~
PD: 9 Information
……………………………
Exit Code: 0x00
4、显示Raid卡型号,Raid设置,Disk相关信息 #/opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL
5、查看raid卡日志 #/opt/MegaRAID/MegaCli/MegaCli64 -FwTermLog -Dsply -aALL
6、查看RAID阵列中掉线的盘 /opt/MegaRAID/MegaCli/MegaCli64 -pdgetmissing -a0
【其它】
1、 做热备
【[email protected] MegaCli]# ./MegaCli64 -pdhsp -set -physdrv[252:3] -a0
Adapter: 0: Set Physical Drive at EnclId-252 SlotId-3 as Hot Spare Success.
Exit Code: 0x00
查看热备盘状态:Firmware state: Hotspare, Spun Up
热备盘删除
./MegaCli64 -PDHSP -Rmv -PhysDrv[Ex:Sx] –aALL
5、uncfgure bad硬盘改成uncfgure good硬盘
MegaCli -PDMakeGood -PhysDrv[E0:S0,E1:S1,...] | [-Force] -aN|-a0,1,2|-aALL
Uncfgure bad状态硬盘,无法对其进行操作。
6、删除foreign信息
MegaCli -CfgForeign -Scan | [-SecurityKey sssssssssss] -aN|-a0,1,2|-aALL
MegaCli -CfgForeign -Clear [x]|[-SecurityKey sssssssssss] -aN|-a0,1,2|-aALL
x - index of foreign configurations. Optional. All by default.
7、如何做rebuild
如有热备盘,硬盘掉线后,热备盘会自动rebuild。
热备盘自动rebuid
Enclosure Device ID: 252
Slot Number: 2
Device Id: 178
Sequence Number: 6
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SATA
Raw Size: 931.512 GB [0x74706db0 Sectors]
Non Coerced Size: 931.012 GB [0x74606db0 Sectors]
Coerced Size: 930.390 GB [0x744c8000 Sectors]
Firmware state: Rebuild
SAS Address(0): 0x9281c0667817c71
Connected Port Number: 2(path0)
Inquiry Data: 9WK0BXZLST31000524NS SN11
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None
Device Speed: 3.0Gb/s
Link Speed: 3.0Gb/s
Media Type: Hard Disk Device
使用MegaCli -PDRbld -ShowProg -PhysDrv [E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL来查看硬盘rebuild进程。
Rebuid结束后,掉线槽位硬盘更换后,自动从热备拷回数据,原热备盘再次变成热备盘,
Enclosure Device ID: 252
Slot Number: 1
Device Id: 179
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SATA
Raw Size: 931.512 GB [0x74706db0 Sectors]
Non Coerced Size: 931.012 GB [0x74606db0 Sectors]
Coerced Size: 930.390 GB [0x744c8000 Sectors]
Firmware state: Copyback
SAS Address(0): 0x9281c06595f6f7c
Connected Port Number: 1(path0)
Inquiry Data: 9WK046MWST31000524NS SN11
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None
Device Speed: 3.0Gb/s
Link Speed: 3.0Gb/s
Media Type: Hard Disk Device
热备盘在rebuid过程中,更换掉线槽位硬盘,查看该硬盘是否有media error即可,确认硬盘为uncfgure good状态,一般RAID卡都可以copyback,后续硬盘会自动从原热备盘拷回数据。
但是考虑到存在无法copyback的情况,在热备盘rebuild完成后再更换硬盘。
无热备盘情况,更换新硬盘,如果自动rebuild,则正常结束即可,如不自动rebuild,可以配置成热备盘。