megacli查看服务器磁盘,存储设备信息的神器

1. 最简单的安装

# 查看服务器
cat /etc/issue
Ubuntu 18.04.2 LTS \n \l

# Add GPG signatures
wget -O - https://hwraid.le-vert.net/debian/hwraid.le-vert.net.gpg.key | sudo apt-key add -
# Add Package Repo  注意Ubuntu版本号xenial
echo "deb http://hwraid.le-vert.net/ubuntu xenial main" | sudo tee -a /etc/apt/sources.list.d/hwraid.list

# Upgrade and Install
sudo apt-get update
sudo apt-get install megacli

2. 安装成功sudo megacli -h

 MegaCLI SAS RAID Management Tool  Ver 8.07.14 Dec 16, 2013

    (c)Copyright 2013, LSI Corporation, All Rights Reserved.

NOTE: The following options may be given at the end of any command below: 

    [-Silent] [-AppLogFile filename] [-NoLog] [-page[N]] 
                 [-] is optional. 
                  N - Number of lines per page. 

MegaCli -v 
MegaCli -help|-h|? 
MegaCli -adpCount 
MegaCli -AdpSetProp {CacheFlushInterval -val} | { RebuildRate -val} 
    | {PatrolReadRate -val} | {BgiRate -val} | {CCRate -val} | {ForceSGPIO -val}
    | {ReconRate -val} | {SpinupDriveCount -val} | {SpinupDelay -val} 
    | {CoercionMode -val} | {ClusterEnable -val} | {PredFailPollInterval -val} 
    | {BatWarnDsbl -val} | {EccBucketSize -val} | {EccBucketLeakRate -val} 
    | {AbortCCOnError -val} | AlarmEnbl | AlarmDsbl | AlarmSilence 
    | {SMARTCpyBkEnbl -val} | {SSDSMARTCpyBkEnbl -val} | NCQEnbl | NCQDsbl 
    | {MaintainPdFailHistoryEnbl -val} | {RstrHotSpareOnInsert -val} 
    | {DisableOCR -val} | {BootWithPinnedCache -val} | {enblPI -val} |{PreventPIImport -val} 
    | AutoEnhancedImportEnbl | AutoEnhancedImportDsbl 
    | {EnblSpinDownUnConfigDrvs -val}|{UseDiskActivityforLocate -val} -aN|-a0,1,2|-aALL 
    | {ExposeEnclDevicesEnbl -val} | {SpinDownTime -val} 
    | {SpinUpEncDrvCnt -val} | {SpinUpEncDelay -val} | {Perfmode -val} -aN|-a0,1,2|-aALL 
    | {PerfMode -val �MaxFlushLines -val �NumIOsToOrder -val} -aN|-a0,1,2|-aALL

3. 查看Raid卡信息

sudo megacli -LDInfo -Lall -aALL

4. 查看硬盘信息,命令会输出很长一段信息,看SizeMedia Type比较常用的参数

sudo megacli -PDList -aALL

5. 常用命令

MegaCli常用参数介绍 
MegaCli -adpCount 【显示适配器个数】
MegaCli -AdpGetTime –aALL 【显示适配器时间】
MegaCli -AdpAllInfo -aAll     【显示所有适配器信息】
MegaCli -LDInfo -LALL -aAll    【显示所有逻辑磁盘组信息】
MegaCli -PDList -aAll    【显示所有的物理信息】
MegaCli -AdpBbuCmd -GetBbuStatus -aALL |grep ‘Charger Status’ 【查看充电状态】
MegaCli -AdpBbuCmd -GetBbuStatus -aALL【显示BBU状态信息】
MegaCli -AdpBbuCmd -GetBbuCapacityInfo -aALL【显示BBU容量信息】
MegaCli -AdpBbuCmd -GetBbuDesignInfo -aALL    【显示BBU设计参数】
MegaCli -AdpBbuCmd -GetBbuProperties -aALL    【显示当前BBU属性】
MegaCli -cfgdsply -aALL    【显示Raid卡型号,Raid设置,Disk相关信息】