MegaCli是一款管理维护硬件RAID软件,能够用来查看raid信息等
MegaCli 的Media Error Count: 0 Other Error Count: 0
Medai Error Count 表示磁盘可能错误,多是磁盘有坏道,这个值不为0值得注意,数值越大,危险系数越高,
Other Error Count 表示磁盘可能存在松动,可能须要从新再插入。MegaCli 能够对阵列中全部的磁盘进行检测。linux
dmidecode -t1 | egrep "Manufacturer|Product Name"
cat /etc/redhat-release
查看厂商和产品型号,以及"Serial Number"git
rpm -qa | egrep ‘Lib_Utils|MegaCli‘ //检查是否安装
https://raw.githubusercontent.com/crazy-zhangcong/tools/master/MegaCli8.07.10.tar.gz
ftp://download2.boulder.ibm.com/ecc/sar/CMA/XSA/ibm_utl_sraidmr_megacli-8.00.48_linux_32-64.zip
解压事后有linux目录github
[root@localhost MegaCli8.07.10]# tree ├── Linux │ ├── Lib_Utils-1.00-09.noarch.rpm │ ├── MegaCli-8.02.21-1.noarch.rpm [root@localhost Linux]# rpm -ivh Lib_Utils-1.00-09.noarch.rpm MegaCli-8.02.21-1.noarch.rpm [root@localhost Linux]# ln -sv /opt/MegaRAID/MegaCli/MegaCli64 /usr/bin/ "/usr/bin/MegaCli64" -> "/opt/MegaRAID/MegaCli/MegaCli64"
/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL 【查raid级别】 /opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL 【查raid卡信息】 /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL 查看【硬盘信息】 /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -aAll 【查看电池信息】 /opt/MegaRAID/MegaCli/MegaCli64 -FwTermLog -Dsply -aALL 【查看raid卡日志】 /opt/MegaRAID/MegaCli/MegaCli64 -adpCount 【显示适配器个数】 /opt/MegaRAID/MegaCli/MegaCli64 -AdpGetTime –aALL 【显示适配器时间】 /opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aAll 【显示全部适配器信息】 /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -LALL -aAll 【显示全部逻辑磁盘组信息】 /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aAll 【显示全部的物理信息】 /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL |grep ‘Charger Status’ 【查看充电状态】 /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL【显示BBU状态信息】 /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuCapacityInfo -aALL【显示BBU容量信息】 /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuDesignInfo -aALL 【显示BBU设计参数】 /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuProperties -aALL 【显示当前BBU属性】 /opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL 【显示Raid卡型号,Raid设置,Disk相关信息】
/opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -L0 -a0【显示0 RAID卡 0 RAID组的缓存策略 /opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -L1 -a0【显示1 RAID卡 0 RAID组的缓存策略】 /opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -LALL -a0【显示全部RAID卡 0 RAID组的缓存策略】 /opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -LALL –aALL【显示全部 RAID卡 全部 RAID组的缓存策略】 /opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -DskCache -LALL -aALL
设置磁盘的缓存模式和访问方式 (Change Virtual Disk Cache and Access Parameters)缓存
Description Allows you to change the following virtual disk parameters: -WT (Write through), WB (Write back): Selects write policy. -NORA (No read ahead), RA (Read ahead), ADRA (Adaptive read ahead): Selects read policy. -Cached, -Direct: Selects cache policy. -RW, -RO, Blocked: Selects access policy. -EnDskCache: Enables disk cache. -DisDskCache: Disables disk cache. MegaCli -LDSetProp { WT | WB|NORA |RA | ADRA|-Cached|Direct} | {-RW|RO|Blocked} | {-Name[string]} | {-EnDskCache|DisDskCache} –Lx | -L0,1,2|-Lall -aN|-a0,1,2|-aALL MegaCli -LDSetProp WT -L0 -a0
显示磁盘缓存和访问方式(Display Virtual Disk Cache and Access Parameters)bash
MegaCli -LDGetProp -Cache | -Access | -Name | -DskCache -Lx|-L0,1,2| -Lall -aN|-a0,1,2|-aALL Displays the cache and access policies of the virtual disk(s): -WT (Write through), WB (Write back): Selects write policy. -NORA (No read ahead), RA (Read ahead), ADRA (Adaptive read ahead): Selects read policy. -Cache, -Cached, Direct: Displays cache policy. -Access, -RW, -RO, Blocked: Displays access policy. -DskCache: Displays physical disk cache policy.
缓存策略解释:ide
WT (Write through) WB (Write back) NORA (No read ahead) RA (Read ahead) ADRA (Adaptive read ahead) C (Cached) D (Direct)
例子:
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp WT|WB|NORA|RA|ADRA -L0 -a0
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -Cached|-Direct -L0 -a0
enable / disable disk cache
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -EnDskCache|-DisDskCache -L0 -a0学习
建立一个raid5阵列,由物理盘2,3,4构成,该阵列的热备盘是物理盘5
/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -Hsp[1:5] -a0
建立阵列,不指定热备
/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -a0
建立一个raid10阵列,由物理盘2,3和4,5分别作raid1,在将两组raid1作raid0
/opt/MegaRAID/MegaCli/MegaCli64 –CfgSpanAdd –r10 –Array0[1:2,1:3] –Array1[1:4,1:5] WB Direct -a0ui
/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdDel -L1 -a0this
/opt/MegaRAID/MegaCli/MegaCli64 -LDRecon -Start -r5 -Add -PhysDrv[1:4] -L1 -a0设计
/opt/MegaRAID/MegaCli/MegaCli64 -LDInit -ShowProg -LALL -aALL
或者以动态可视化文字界面显示
/opt/MegaRAID/MegaCli/MegaCli64 -LDInit -ProgDsply -LALL -aALL
/opt/MegaRAID/MegaCli/MegaCli64 -LDBI -ShowProg -LALL -aALL
或者以动态可视化文字界面显示
/opt/MegaRAID/MegaCli/MegaCli64 -LDBI -ProgDsply -LALL -aALL
/opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Set [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0
/opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Set [-Dedicated [-Array1]] [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0
/opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Rmv -PhysDrv[1:5] -a0
/opt/MegaRAID/MegaCli/MegaCli64 -PDOffline -PhysDrv [1:4] -a0
/opt/MegaRAID/MegaCli/MegaCli64 -PDOnline -PhysDrv [1:4] -a0
/opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ShowProg -PhysDrv [1:5] -a0
或者以动态可视化文字界面显示
/opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ProgDsply -PhysDrv [1:5] -a0
Device |Normal|Damage|Rebuild|Normal
Virtual Drive |Optimal|Degraded|Degraded|Optimal
Physical Drive |Online|Failed –> Unconfigured|Rebuild|Online
/opt/MegaRAID/MegaCli/MegaCli64 -ldgetprop -dskcache -lall -aall
查看电池状态信息(Display BBU Status Information)
MegaCli -AdpBbuCmd -GetBbuStatus -aN|-a0,1,2|-aALL
MegaCli -AdpBbuCmd -GetBbuStatus -aALL
查看电池容量(Display BBU Capacity Information)
MegaCli -AdpBbuCmd -GetBbuCapacityInfo -aN|-a0,1,2|-aALL
MegaCli -AdpBbuCmd -GetBbuCapacityInfo –aALL
查看电池设计参数(Display BBU Design Parameters)
MegaCli -AdpBbuCmd -GetBbuDesignInfo -aN|-a0,1,2|-aALL
MegaCli -AdpBbuCmd -GetBbuDesignInfo –aALL
查看电池属性(Display Current BBU Properties)
MegaCli -AdpBbuCmd -GetBbuProperties -aN|-a0,1,2|-aALL
MegaCli -AdpBbuCmd -GetBbuProperties –aALL
设置电池为学习模式为循环模式(Start BBU Learning Cycle)
Description Starts the learning cycle on the BBU.
No parameter is needed for this option.
MegaCli -AdpBbuCmd -BbuLearn -aN|-a0,1,2|-aALL
MEGACLI="/opt/MegaRAID/MegaCli/MegaCli64 " $MEGACLI -pdlist -aALL | grep "Firmware state" | awk -F : ‘{print $2}‘ | awk -F , ‘{print $1}‘ $MEGACLI -pdlist -aALL | grep -E "Media Error|Other Error" | awk -F : ‘{print $2}‘
图一、图2