megacli コマンド

Adapter parameter -aN

The parameter -aN (where N is a number starting with zero or the string ALL) specifies the PERC5/i adapter ID. If you have only one controller it is safe to use ALL instead of a specific ID, but you are encouraged to use the ID fohing that makes changes to your RAID configuration.

Physical drive parameter -PhysDrv [E:S]

For commands that operate on one or more pysical drives, the -PhysDrv [E:S] parameter is used, where E is the enclosure device ID in which the drive resides and S the slot number (starting with zero). You can get the enclosure device ID using '${megacli} -EncInfo -aALL'. The E:S syntax is also used for specifying the physical drives when creating a new RAID ual drive.

https://www.maths.cam.ac.uk/computing/docs/public/megacli_raid_lsi.html

HW保守で使いそうなTips 〜ディスク周り〜
https://qiita.com/shotaTsuge/items/85d6d63f47fafbc24911

megacli -AdpAllInfo -aALL

megacli -LDInfo -Lall -aALL

megacli -PDList -aALL

megacli -PDList -aALL | grep -e "Slot Number" -e "Error Count" -e "Firmware state"
ログ確認
megacli  -AdpEventLog -GetLatest 100 -info -f /tmp/megaclievent.log -a0 -NoLog

時刻

MegaCli -AdpGetTime -a0
リビルド

リビルドの進捗確認
以下のコマンドでリビルドの進捗状況を確認できます。

MegaCli -PDRbld -ShowProg -PhysDrv [エンクロージャID:スロットナンバー] -aアダプタN

/opt/lsi/MegaCLI # ./MegaCli -PDRbld -ShowProg -PhysDrv [252:4] -a0

Rebuild Progress on Device at Enclosure 252, Slot 4 Completed 66% in 10 Minutes.

Exit Code: 0x00

https://xmms.jp/confluence/pages/viewpage.action?pageId=852020

Enclosure N/A の場合は [E:S] のEを省略する。

./MegaCli -PDRbld -ShowProg -PhysDrv [:0] -a0
                                     
Rebuild Progress on Device at Enclosure N/A, Slot 0 Completed 24% in 77 Minutes.

Rebuildの進捗確認

#  -physdrv[Enclosure Device id:Slot Number]
$ /opt/MegaRAID/MegaCli/MegaCli64 -AdpGetProp RebuildRate -a0
$ /opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -showprog -physdrv[E:S] -a0

https://qiita.com/shotaTsuge/items/85d6d63f47fafbc24911

BBU バッテリー

確認

megacli -AdpBbuCmd -aALL
sudo MegaCli -AdpBbuCmd -BbuLearn -a0
ディスク交換

こんな感じでできる。 ただ、PDmarkMissingが対応していない場合があるので注意。
http://cequiestaime.blogspot.com/2012/06/megacli64.html

http://d.hatena.ne.jp/mtkys+tech-memo/20121215/1355591665

FOREIGN DISK config

Now you can ask the controller to scan for foreign configurations and remove them:

server:~# MegaCli64 -CfgForeign -Scan -a0
There are 1 foreign configuration(s) on controller 0.

server:~# MegaCli64 -CfgForeign -Clear -a0
Foreign configuration 0 is cleared on controller 0.

RAID: Rebuilding a Foreign disk by hand | ErikIMH - just another linux admin's blog

ホットスペア Copyback

MegaRAIDにはコピーバックという機能があります。
まずホットスペアを設定しているRAIDで故障が発生し、ホットスペアドライブを使用してのリビルドが自動で開始されます。
その間に、障害が発生したドライブを交換します。すると、リビルド完了後に交換されたドライブに対して“コピー“が開始されます。
コピーが完了すると、交換したドライブがRAIDの構成ドライブとなり、使用されたホットスペアは再びホットスペアとして残ります。
よって、ドライブのスロット位置を固定したままでのホットスペア運用が可能となります。
コピーバックとは

進捗

$ MegaCli -PDCpyBk -showprog -physdrv[32:10] -a0