1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > linux查看硬盘阵列卡信息命令 查看服务器RAID卡信息的SHELL脚本及MegaCLI命令介绍...

linux查看硬盘阵列卡信息命令 查看服务器RAID卡信息的SHELL脚本及MegaCLI命令介绍...

时间:2020-12-28 09:29:14

相关推荐

linux查看硬盘阵列卡信息命令 查看服务器RAID卡信息的SHELL脚本及MegaCLI命令介绍...

目前维护的dDell服务器,大多使用的都是LSI的MegaRAID卡。

查看系统使用的什么RAID卡,可以使用以下命令:#dmesg|grep-iraid

#cat/proc/scsi/scsi

#lspci

MegaRAID卡,可以通过官方提供的工具MegaCli来进行检查和控制。

下面是自动检查服务器RAID信息的SHELL脚本:#!/bin/sh

Hostname=`/bin/hostname`

Hostip=`ifconfigeth0|grep'inetaddr'|sed's/.*addr:\(.*\)Bcast.*/\1/'`

Battery=`/opt/MegaCli-AdpBbuCmd-GetBbuStatus-aALL|grep"ChargerStatus"|awk-F:'{print$1":"$2}'`

raid=`/opt/MegaCli-cfgdsply-aALL|grep"RAIDLevel"|tail-1|awk-F:'{print$1":"$2}'`

Disknum=`/opt/MegaCli-cfgdsply-aALL|grep-c"NonCoercedSize"`

Onlinedisk=`/opt/MegaCli-cfgdsply-aALL|grep“Online”|wc-l|sed's///'`

Faileddisk=`/opt/MegaCli-AdpAllInfo-aALL|grep"FailedDisks"|awk-F'''{print$4}'`

echo"=====================HostInformation====================="

echo"HostName:$Hostname"

echo-e"HostIp:$Hostip\n"

echo"=====================RaidInformation====================="

#echo"$Raidmode"

case"$raid"

in

"RAIDLevel:Primary-1,Secondary-0,RAIDLevelQualifier-0")echo"RaidLevel:Raid1";;

"RAIDLevel:Primary-0,Secondary-0,RAIDLevelQualifier-0")echo"RaidLevel:Raid0";;

"RAIDLevel:Primary-5,Secondary-0,RAIDLevelQualifier-3")echo"RaidLevel:Raid5";;

"RAIDLevel:Primary-1,Secondary-3,RAIDLevelQualifier-0")echo"RaidLevel:Raid10";;

esac

if[-z"$Battery"];then

echo"Battery:Null"

else

echo"$Battery"

fi

echo"TotalDiakNumber:$Disknum"

echo"OnlineDiskNumber:$Onlinedisk"

echo"FailedDiskNumber:$Faileddisk"

脚本运行结果:=====================HostInformation=====================

HostName:

HostIp:199.15.166.*

=====================RaidInformation=====================

RaidLevel:Raid5

ChargerStatus:Complete

ChargerStatus:Complete

TotalDiakNumber:9

OnlineDiskNumber:0

FailedDiskNumber:0

MegaCli常用参数组合介绍:MegaCli-cfgdsply-aALL|grep"Error"【正常都是0】

MegaCli-LDGetProp-Cache-LALL-a0【写策略】

MegaCli-cfgdsply-aALL|grep"Memory"【内存大小】

MegaCli-LDInfo-Lall-aALL【查RAID级别】

MegaCli-AdpAllInfo-aALL【查RAID卡信息】

MegaCli-PDList-aALL【查看硬盘信息】

MegaCli-AdpBbuCmd-aAll【查看电池信息】

MegaCli-FwTermLog-Dsply-aALL【查看RAID卡日志】

MegaCli-adpCount【显示适配器个数】

MegaCli-AdpGetTime–aALL【显示适配器时间】

MegaCli-AdpAllInfo-aAll【显示所有适配器信息】

MegaCli-LDInfo-LALL-aAll【显示所有逻辑磁盘组信息】

MegaCli-PDList-aAll【显示所有的物理信息】

MegaCli-AdpBbuCmd-GetBbuStatus-aALL|grep"ChargerStatus"【查看充电状态】

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相关信息】

磁带状态的变化,从拔盘,到插盘的过程中:Device|Normal|Damage|Rebuild|Normal

VirtualDrive|Optimal|Degraded|Degraded|Optimal

PhysicalDrive|Online|Failed–>Unconfigured|Rebuild|Online

磁盘各个状态说明:Aphysicaldiskdrivepropertyindicatingthestatusofthedrive.Aphysicaldiskdrivecanbeinoneof

thefollowingstates:

>UnconfiguredGood

AdiskaccessibletotheRAIDcontrollerbutnotconfiguredasapartofavirtualdiskorasahotspare.

>Online

AphysicaldiskcanbeaccessedbytheRAIDcontrollerandispartofthevirtualdisk.

>rebuild

Aphysicaldisktowhichdataisbeingwrittentorestorefullredundancyforavirtualdisk.

>failed

AphysicaldiskthatwasoriginallyconfiguredasOnlinebutonwhichthefirmwaredetectsanunrecoverableerror.

>Unconfiguredbad

Aphysicaldiskonwhichthefirmwaredetectsanunrecoverableerror;thephysicaldiskwasUnconfiguredGoodorthephysicaldiskcouldnotbeinitialized.

Diskswithastatusof"Unconfiguredbad"cannotbeusedforRAIDconfigurations.

>Missing

AphysicaldiskthatwasOnline,butwhichhasbeenremovedfromitslocation.

>offline

Thedriveisofflineorabsent.Noactionscanbeperformedonthedriveuntilitisbackonline.

>Globalhotspare

Thedrivewillbeusedtorepairanyarrayinthesystemthathadadrivefailure,ifthefaileddriveisequalto,orsmallerthanthehotsparedrive.

>Ready

Thedriveisonlineandoperatingcorrectly.

>Foreign

Thedriveispartofanarraycreatedonadifferentcontroller,orcreatedwithinoneenclosureandmovedtoanotheronthesamecontroller.Itcanbeusedtocreateanewarrayafterclearingconfiguration.

>None

Aphysicaldiskwiththeunsupportedflagset.AnUnconfiguredGoodorOfflinephysicaldiskthathascompletedtheprepareforremovaloperation.

>copyback

Abadphysicaldiskreplacedbyagoodone,thenhotsparewillcopybackdatatothegoodoneandchangebacktohotspare

命令使用:#/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相关信息】

3.磁带状态的变化,从拔盘,到插盘的过程中。Device |Normal|Damage|Rebuild|NormalVirtual Drive |Optimal|Degraded|Degraded|OptimalPhysical Drive |Online|Failed –> Unconfigured|Rebuild|Online

4.查看磁盘缓存策略#/opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -L0 -a0or#/opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -L1 -a0or#/opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -LALL -a0ro#/opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -LALL -aALLro#/opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -DskCache -LALL -aALL

5.设置磁盘缓存策略缓存策略解释:WT(Writethrough

WB(Writeback)

NORA(Noreadahead)

RA(Readahead)

ADRA(Adaptivereadahead)

Cached

Direct

例子:#/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp WT|WB|NORA|RA|ADRA -L0 -a0or#/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -Cached|-Direct -L0 -a0orenable / disable disk cache#/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -EnDskCache|-DisDskCache -L0 -a0

6.创建一个 raid5 阵列,由物理盘 2,3,4 构成,该阵列的热备盘是物理盘 5#/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -Hsp[1:5] -a0

7.创建阵列,不指定热备#/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -a0

8.删除阵列#/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdDel -L1 -a0

9.在线添加磁盘#/opt/MegaRAID/MegaCli/MegaCli64 -LDRecon -Start -r5 -Add -PhysDrv[1:4] -L1 -a0

10.阵列创建完后,会有一个初始化同步块的过程,可以看看其进度。#/opt/MegaRAID/MegaCli/MegaCli64 -LDInit -ShowProg -LALL -aALL或者以动态可视化文字界面显示#/opt/MegaRAID/MegaCli/MegaCli64 -LDInit -ProgDsply -LALL -aALL

11.查看阵列后台初始化进度#/opt/MegaRAID/MegaCli/MegaCli64 -LDBI -ShowProg -LALL -aALL或者以动态可视化文字界面显示#/opt/MegaRAID/MegaCli/MegaCli64 -LDBI -ProgDsply -LALL -aALL

12.指定第 5 块盘作为全局热备#/opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Set [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0

13.指定为某个阵列的专用热备#/opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Set [-Dedicated [-Array1]] [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0

14.删除全局热备#/opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Rmv -PhysDrv[1:5] -a0

15.将某块物理盘下线/上线#/opt/MegaRAID/MegaCli/MegaCli64 -PDOffline -PhysDrv [1:4] -a0#/opt/MegaRAID/MegaCli/MegaCli64 -PDOnline -PhysDrv [1:4] -a0

16.查看物理磁盘重建进度#/opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ShowProg -PhysDrv [1:5] -a0或者以动态可视化文字界面显示#/opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ProgDsply -PhysDrv [1:5] -a0

磁带状态的变化,从拔盘,到插盘的过程中:Device |Normal|Damage|Rebuild|NormalVirtual Drive |Optimal|Degraded|Degraded|OptimalPhysical Drive |Online|Failed –> Unconfigured|Rebuild|Online

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。