一、工具安装

cd /tmp;unzip 8-07-06_MegaCLI.zip
cd /tmp/Linux;rpm -ivh MegaCli-8.07.06-1.noarch.rpm
ln -s /opt/MegaRAID/MegaCli/MegaCli64 /bin/MegaCli64;ln -s /opt/MegaRAID/MegaCli/MegaCli64 /sbin/MegaCli64
  • 查看阵列级别
/opt/MegaRAID/MegaCli/MegaCli64

二、工具使用

  • 1、导出日志

    sudo /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL >/tmp/mega_`date +"%Y%m%d"`.log
    cat /tmp/mega_`date +"%Y%m%d"`.log |grep -i 'Media Error Count|Slot Number'|awk '{tmp=$0;getline;print tmp"\t"$0}' >> /tmp/mega.format
    cat /tmp/mega_`date +"%Y%m%d"`.log |grep -i 'Other Error Count|Slot Number'|awk '{tmp=$0;getline;print tmp"\t"$0}' >> /tmp/mega.format
    
  • 2、查error count(media报错影响较大重点关注)

    cat /tmp/mega.format|grep -v 'Error Count: 0'|sort -u|sort -n -k7|tail -3
    
  • 3、查磁盘状态(Spun Up属于正常,其他状态需要核查)

    cat /tmp/mega_date +"%Y%m%d".log|grep 'Slot Number|Firmware state'|awk '{tmp=$0;getline;print tmp"\t"$0}'
    

三、rebuild进度(65为Enclosure Device ID、18为Slot number)

  • 1、先排查哪个磁盘在rebuild和 Enclosure Device ID、和磁盘id

    sudo /opt/MegaRAID/MegaCli/MegaCli64  -PDList -aAll -NoLog|egrep 'Enclosure Device ID|Slot Number|Firmware state'
    
  • 2、查看Rebuild进度

    sudo /opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ShowProg -PhysDrv[65:18] -aALL
    

四、热备盘操作

/opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Set [-EnclAffinity] [-nonRevertible] -PhysDrv[32:7] -a0
  • 指定第1张阵列卡的第8块盘作为全局热备 (默认从0开始计数)
  • 为指定第1张阵列卡的第5块盘作为局部阵列(raid5)的热备
/opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Set [-Dedicated [-Array1]] [-EnclAffinity] [-nonRevertible] -PhysDrv[64:4] -a0