MegaCli使用手册
一、下載MegaCli
下載地址:ftp://download2.boulder.ibm.com/ecc/sar/CMA/XSA/ibm_utl_sraidmr_megacli-8.00.48_linux_32-64.zip
或https://docs.broadcom.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/8-07-06_MegaCLI.zip
在線(xiàn)下載:
wget ftp://download2.boulder.ibm.com/ecc/sar/CMA/XSA/ibm_utl_sraidmr_megacli-8.00.48_linux_32-64.zip
wget這個(gè)工具沒(méi)有的話(huà)就需要安裝
# yum install wget -y
二、安裝
解壓zip安裝包
# unzip ibm_utl_sraidmr_megacli-8.00.48_linux_32-64.zip
切換到安裝包目錄
# cd linux/
使用rpm安裝
# rpm -ivh Lib_Utils-1.00-09.noarch.rpmMegaCli-8.00.48-1.i386.rpm
查看文件安裝在哪
# rpm -ql MegaCli-8.00.48-1.i386
可以做個(gè)軟鏈接 —-相當(dāng)于windous里面的快捷方式
# ln -s /opt/MegaRAID/MegaCli/MegaCli64 /bin/MegaCli64
# ln -s /opt/MegaRAID/MegaCli/MegaCli64 /sbin/MegaCli64
三、使用命令及參數(shù) 使用參數(shù)可以不用區(qū)分大小寫(xiě)
查看幫助:
# MegaCli64 -h
1.查看RAID控制器的數(shù)量:—–raid卡管理要用到
# MegaCli64 -adpCount圖中看出RAID控制器的數(shù)量為1
2.查看所有raid卡詳細(xì)信息
# MegaCli64 -AdpAllInfo -aALL
3.查看連接RAID卡的全部硬盤(pán)詳細(xì)信息
# MegaCli64 -PDList -aALL —-其中ALL意思是所有的控制器,此處也可以用0表示
# MegaCli64 -PDList -aNN可以根據(jù)Adapter #0來(lái)確定
N表示raid卡控制器編號(hào),0表示第一塊raid卡;ALL表示所有的raid卡
Adapter#0 —–raid卡控制器編號(hào)
EnclosureDevice ID: 252 —–外殼設(shè)備ID,也就是raid卡的ID號(hào)
SlotNumber: 4 ——槽號(hào)
Enclosureposition: 0 ——外殼位置
DeviceId: 49 —–設(shè)備ID
SequenceNumber: 2 —–序號(hào)
Media Error Count: 0—–介質(zhì)錯(cuò)誤計(jì)數(shù)
Other Error Count: 0—–其它錯(cuò)誤計(jì)數(shù)
Predictive Failure Count: 0—–預(yù)測(cè)故障計(jì)數(shù)
Last Predictive Failure Event Seq Number: 0
PD Type:SATA —–磁盤(pán)接口類(lèi)型
Raw Size:3.638 TB [0x1d1c0beb0 Sectors] —–磁盤(pán)原始大小
NonCoerced Size: 3.637 TB [0x1d1b0beb0 Sectors]—–磁盤(pán)標(biāo)準(zhǔn)大小
CoercedSize: 3.637 TB [0x1d1b00000 Sectors]——磁盤(pán)最大可用大小
Firmware state: Unconfigured(good),Spun down —–固件狀態(tài):未配置(好的),未連接
SASAddress(0): 0x4433221107000000
ConnectedPort Number: 3(path0) ——連接端口號(hào)
InquiryData:Z1ZBBJWWST4000NM0033-9ZM170 SN06 —–硬盤(pán)的序列號(hào)、型號(hào)、固件版本
FDECapable: Not Capable
FDEEnable: Disable
Secured:Unsecured
Locked:Unlocked
Needs EKMAttention: No
ForeignState: None
DeviceSpeed: 6.0Gb/s
LinkSpeed: 6.0Gb/s
MediaType: Hard Disk Device
Drive: Not Certified
DriveTemperature : N/A —-設(shè)備溫度
需要特別關(guān)注這幾個(gè)指標(biāo):Media Error / Other Error / Predictive Failure Count / LastPredictive Failure Event Seq Number
4.查看E S: —–獲得磁盤(pán)的ID編號(hào),E表示Enclosure Device,S表示Slot Number
由于磁盤(pán)信息較多,所有可以根據(jù)自己的需要來(lái)過(guò)濾得到自己想要的信息
# MegaCli64 -PDList -aAll| grep -Ei”(Enclosure Device|Slot Number|Raw Size|Firmware state)” —粗過(guò)濾
grep是過(guò)濾的意思
-E參數(shù)是使用擴(kuò)展正則表達(dá)式來(lái)過(guò)濾
-i參數(shù)是不區(qū)分大小寫(xiě)來(lái)過(guò)濾
Enclosure Device過(guò)濾出raid卡的ID;Slot Number過(guò)濾出磁盤(pán)的槽號(hào);RawSize過(guò)濾出磁盤(pán)的大??;Firmware state過(guò)濾出磁盤(pán)的狀態(tài)。
# MegaCli64 -PDList -aALL|grep -Ei “(EnclosureDevice|Slot Number|PD Type|Raw Size|Inquiry Data|Firmware state|ForeignState)” —-精過(guò)濾
Enclosure Device過(guò)濾出raid卡的ID;Slot Number過(guò)濾出磁盤(pán)的槽號(hào);Raw Size過(guò)濾出磁盤(pán)的大小;Inquiry Data 過(guò)濾出磁盤(pán)的序列號(hào)、型號(hào)固件版本;Firmware state過(guò)濾出磁盤(pán)的狀態(tài);
5.創(chuàng)建raid
MegaCli64 -CfgLdAdd -r(0|1|5) [E:S, E:S, …] -aN
N表示raid卡編號(hào),0表示第一塊raid卡;ALL表示所有的raid卡
創(chuàng)建raid5 固件狀態(tài)會(huì)由Unconfigured變成Online
# MegaCli64 -CfgLdAdd -r5 [252:4,252:5,252:6] WT -a0
解析:創(chuàng)建一個(gè)raid5,由252:4,252:5,252:6這3塊磁盤(pán)組成,WT為設(shè)置的緩存類(lèi)型。
注:如果不設(shè)置緩存類(lèi)型,則raid的緩存類(lèi)型為默認(rèn)的緩存類(lèi)型
創(chuàng)建raid10
MegaCli64 -CfgSpanAdd -r10 -Array0[E:S;E:S] -Array1[E:S;E:S]-Array*[E:S;E:S] -a0
# MegaCli64 -CfgSpanAdd -r10 -Array0[252:4,252:5] -Array1[252:6,252:7]WT-a0
解析:創(chuàng)建一個(gè)raid10,252:4;252:5做raid1組成Array0;252:6;252:7做raid1組成Array1,最后由Array0和Array1做raid0。
6.查看raid級(jí)別
# MegaCli64 -LdPdInfo -aALL —–查看raid級(jí)別及raid由哪些磁盤(pán)組成。
# MegaCli64 -LDInfo -Lall -aALL
Adapter 0– Virtual Drive Information:
VirtualDrive: 0 (Target Id: 0) —-設(shè)備VD號(hào)
Name :
RAIDLevel : Primary-5, Secondary-0,RAID Level Qualifier-3 —-raid級(jí)別
Size : 7.276 TB —–邏輯磁盤(pán)大小
State : Optimal —–狀態(tài):最佳
StripSize : 256 KB —–簇的大小
Number OfDrives : 3
SpanDepth : 1
DefaultCache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU —-默認(rèn)緩存策略
CurrentCache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU —–當(dāng)前緩存策略
AccessPolicy : Read/Write —–存取策略
DiskCache Policy : Disk’s Default —–磁盤(pán)緩存策略
EncryptionType : None
BadBlocks Exist: No
RAID Level對(duì)應(yīng)關(guān)系:RAID級(jí)別一般通過(guò) Primary 字段值來(lái)判斷
還需要結(jié)合Span Depth的值來(lái)判斷值為1表示為 RAID-1,不為1表示 RAID-10; 還有一種情況:Primary-1, Secondary-3, RAID LevelQualifier-0 也是表示 RAID-10;
RAIDLevel : Primary-0, Secondary-0, RAID Level Qualifier-0 對(duì)應(yīng)RAID 0
RAIDLevel : Primary-1, Secondary-0, RAID Level Qualifier-0 對(duì)應(yīng)RAID 1
RAIDLevel : Primary-5, Secondary-0, RAID Level Qualifier-3 對(duì)應(yīng)RAID 5
RAIDLevel : Primary-1, Secondary-3, RAID Level Qualifier-0 對(duì)應(yīng)RAID 10
7.刪除raid:
通過(guò)查看raid級(jí)別獲得Virtual Drive編號(hào)
刪除某個(gè)raid
MegaCli64 -CfgLdDel -LX -a0
X是第幾個(gè)陣列(VD號(hào):Virtual Drive: X);0表示第一個(gè)陣列。
刪除第一個(gè)raid卡上的所有raid(慎用)
MegaCli64 -CfgClr -a0
清除raid信息:清除所有的raid(慎用)
8.查看 RAID 卡 Rebuild 參數(shù):重建在IO資源使用中的百分比,默認(rèn)為30%
# MegaCli64 -AdpAllinfo -aALL |grep -i rebuild
9.設(shè)置 RAID 卡 Rebuild 比例為60%:調(diào)整重建在IO資源使用中的百分比為60%
此項(xiàng)可以根據(jù)客戶(hù)要求來(lái)設(shè)定
# MegaCli64 -AdpSetProp { RebuildRate -60} -aALL
10.查看電池信息:配置電池才能看到詳細(xì)信息
沒(méi)有電池或電池故障會(huì)出現(xiàn)以下報(bào)錯(cuò)
# MegaCli64 -AdpBbuCmd -aALL
BatteryType:CVPM03 —–電池型號(hào)
Voltage:9464 mV —–電壓
Current:0 mA —–電流
Temperature:35 C —–電池溫度
BBUFirmware Status:
Charging Status : None —–充電狀態(tài):未充電
Voltage : OK
Temperature : OK
Learn Cycle Requested : No
Learn Cycle Active : No
Learn Cycle Status : OK
Learn Cycle Timeout : No
I2c Errors Detected : No —-檢測(cè)錯(cuò)誤:無(wú)
Battery Pack Missing : No
Battery Replacement required : No
Remaining Capacity Low : No
Periodic Learn Required : No
Transparent Learn : No
No space to cache offload : No
Pack is about to fail & should bereplaced : No
Cache Offload premium feature required : No
Module microcode update required : No
Batterystate:
GasGuageStatus:
Fully Discharged : Yes—-完全放電
Fully Charged : Yes —-完全充電
Discharging : Yes
Initialized : Yes —-初始化
Remaining Time Alarm : No
Remaining Capacity Alarm: Yes
Discharge Terminated : Yes
Over Temperature : No
Charging Terminated : Yes—-充電終止:是
Over Charged : No —-負(fù)載充電:無(wú)
Pack energy : 249 J —–容量包大小
Capacitance : 110 —–電流容量
Remaining reservespace : 0
11.設(shè)置全局熱備盤(pán)
MegaCli64 -PDHSP -set -PhysDrv[E:S] -a0
# MegaCli64 -PDHSP -set -PhysDrv[252:7] -a0
刪除全局熱備盤(pán)
MegaCli64 -PDHSP -Rmv -PhysDrv[E:S] -a0
# MegaCli64 -PDHSP -Rmv -PhysDrv[252:7] -a0
12.將物理盤(pán)下線(xiàn)和上線(xiàn)
# MegaCli64 -PDOffline/PDOnline -PhysDrv [E:S] -a0
下線(xiàn)(failed狀態(tài)的盤(pán)可以下線(xiàn))
# MegaCli64 -PDOffline -PhysDrv[252:7] -a0
上線(xiàn)
# MegaCli64 -PDOnline -PhysDrv[252:6] -a0
13.在線(xiàn)添加磁盤(pán)
# MegaCli64 -LDRecon -Start -r5 -Add -PhysDrv[252:7] -L0-a0
查看擴(kuò)容的進(jìn)度
# MegaCli64 -LDRecon -progdsply -L0 –a0
14. 查看RAID卡緩存策略
# MegaCli64 -LDinfo -Lall -aAll|grep -i “CachePolicy:”
Default Cache Policy: WriteBack, ReadAhead, Direct, NoWrite Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAheadNone, Cached,No Write Cache if Bad BBU
第一段
WriteBack:寫(xiě)緩存策略
WriteThrough:直接寫(xiě)入磁盤(pán),不適用RAID卡緩存。
第二段
ReadAheadNone:不開(kāi)啟預(yù)讀
ReadAhead:開(kāi)啟預(yù)讀,在讀操作的時(shí)候,預(yù)先把后面順序的數(shù)據(jù)載入raid卡緩存,在順序讀的環(huán)境中能提供很好的性能,但是在隨機(jī)讀的環(huán)境中反而降低讀的性能(適合文件系統(tǒng),不適合數(shù)據(jù)庫(kù)系統(tǒng))
ReadAdaptive:自適應(yīng)預(yù)讀,在緩存和I/O空閑時(shí)選擇預(yù)讀,默認(rèn)策略。
第三段
Direct:讀操作不緩存到RAID卡緩存。
Cached:讀操作緩存到RAID卡緩存。
第四段 如果BBU(電池)出現(xiàn)問(wèn)題是否啟用WriteCache
No Write Cache if Bad BBU:如果BBU出現(xiàn)問(wèn)題不使用WriteCache,從WriteBack自動(dòng)切換到WriteThrough,默認(rèn)配置。
Write Cache OK if Bad BBU: 如果BBU出現(xiàn)問(wèn)題仍啟用WriteCache,這種配置是非常不安全的,除非是有UPS或者雙電源的情況下。
緩存策略解釋?zhuān)?/p>
WT (WriteThrough
WB (WriteBack)
NORA (ReadAheadNone)
RA (ReadAhead)
ADRA (ReadAdaptive)
Cached
Direct
修改WriteBack:
# MegaCli64 -LDSetProp -WB -Lall -aAll
修改WriteThrough:
# MegaCli64 -LDSetProp -WT -Lall -aAll
修改Cached:
# MegaCli64 -LDSetProp -Cached -Lall -aAll
修改Direct:
# MegaCli64 -LDSetProp – Direct -Lall -aAll
15. 點(diǎn)亮指定硬盤(pán)(定位)
# MegaCli64 -PDLocate -start -physdrv[252:4] -a0
關(guān)閉定位燈
# MegaCli64 -PDLocate -stop -physdrv[252:4] -a0
16. 固件升級(jí)
MegaCli64 -adpfwflash -f x.rom -a0
# MegaCli64 -adpfwflash -f mr3108fw.rom -a0
四、問(wèn)題處理
1.Firmwarestate:Unconfigured(good), Spun down解決方法:
重新熱拔插指定硬盤(pán),該狀態(tài)會(huì)變成Firmware state:Unconfigured(good), Spun Up
創(chuàng)建raid后磁盤(pán)狀態(tài)也會(huì)由Spun down變成SpunUp
2.Firmware state: Unconfigured(bad)解決辦法:
MegaCli64 -PDMakeGood -PhysDrv[E:S] -a0 固件狀態(tài)會(huì)由Unconfigured(bad)變成Unconfigured(good), Spun Up
# MegaCli64 -PDMakeGood -PhysDrv[252:7] -a0
3.Firmware state: failed解決辦法:
出現(xiàn)failed狀態(tài)的硬盤(pán)大多已損壞,建議更換(或報(bào)修);但可以強(qiáng)制上線(xiàn)。
強(qiáng)制上線(xiàn)步驟如下:
可以先將磁盤(pán)下線(xiàn)。# MegaCli64 -PDOffline-PhysDrv[E:S] -a0
然后再上線(xiàn)。 # MegaCli64 -PDOnline -PhysDrv[E:S] -a0
4.以下?tīng)顟B(tài)的解決辦法:
Foreign State: Foreign
Foreign Secure: Drive is notsecured by a foreign lock key
辦法一:可以清除恢復(fù)狀態(tài)(慎用)
# MegaCli64 -CfgForeign -Clear -a0
辦法二:導(dǎo)入配置,恢復(fù)虛擬磁盤(pán)組
# MegaCli64 -CfgForeign -import -a0
5.修改策略報(bào)錯(cuò):原因是當(dāng)前在重建,等重建好就可以了
# MegaCli64 -LDSetProp -Direct -L0 -a0
6.如何定位設(shè)備/dev/sd*由哪些磁盤(pán)組成并點(diǎn)亮指定硬盤(pán)。
# udevadm info -q path -n /dev/sda
可以看出設(shè)備/dev/sda是raid下的Virtual Drive: 0
然后確定Virtual Drive: 0是由哪些磁盤(pán)組成,并點(diǎn)亮磁盤(pán)
# MegaCli64 -ldpdinfo -a0|grep -Ei “(VirtualDrive:|RAID Level|^Size|Enclosure Device|Slot Number)”
上圖可以看出Virtual Drive: 0是由[252:4]這個(gè)磁盤(pán)組成
總結(jié)
以上是生活随笔為你收集整理的MegaCli使用手册的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: zhs16gbk对应mysql_数据库的
- 下一篇: stm32开发教程_单片机STM32