The Storage Command Line Tool (StorCLI)
一、MegaCli 與 StorCli
https://www.cnblogs.com/luxiaodai/p/9878747.html
二、StorCli 簡介
The Storage Command Line Tool (StorCLI) is the command line management software designed for the MegaRAID® product line. The StorCLI is a command line interface that is designed to be easy to use, consistent, and easy to script. This document is the reference manual for installing and using the Storage Command Line Tool, and it explains the various features of the Storage Command Line Tool.
https://docs.broadcom.com/doc/12352476
三、StorCLI 獨立公用程式下載
https://downloadcenter.intel.com/zh-tw/product/82029
四、Intel® RAID Software User Guide
五、安裝storyline

六、安裝路徑及檔案
[root@starfish storcli]# pwd
/opt/MegaRAID/storcli
[root@starfish storcli]# ls -al
總計 7588
drwxr-xr-x. 2 root root 42 5月 22 14:41 .
drwxr-xr-x. 3 root root 21 5月 22 14:41 ..
-rw-r--r--. 1 root root 0 5月 22 14:41 install.log
-rwxr-xr-x. 1 root root 7766688 4月 1 19:28 storcli64
[root@starfish storcli]#
七、Cache寫機制:Write-through與Write-back
https://www.itread01.com/content/1547490026.html
八、storcli64 簡易使用
./storcli64 show all CLI Version = 007.1513.0000.0000 Apr 01, 2021 Operating system = Linux 3.10.0-1160.25.1.el7.x86_64 Status Code = 0 Status = Success Description = None Number of Controllers = 1 Host Name = abc.com Operating System = Linux 3.10.0-1160.25.1.el7.x86_64 StoreLib IT Version = 07.1600.0200.0900 StoreLib IR3 Version = 16.14-0 System Overview : =============== ---------------------------------------------------------------------------------- Ctl Model Ports PDs DGs DNOpt VDs VNOpt BBU sPR DS EHS ASOs Hlth ---------------------------------------------------------------------------------- 0 LSIMegaRAIDSAS9260-8i 8 8 2 0 2 0 N/A On 1&2 Y 2 Opt ---------------------------------------------------------------------------------- Ctl=Controller Index|DGs=Drive groups|VDs=Virtual drives|Fld=Failed PDs=Physical drives|DNOpt=Array NotOptimal|VNOpt=LD NotOptimal|Opt=Optimal Msng=Missing|Dgd=Degraded|NdAtn=Need Attention|Unkwn=Unknown sPR=Scheduled Patrol Read|DS=DimmerSwitch|EHS=Emergency Spare Drive Y=Yes|N=No|ASOs=Advanced Software Options|BBU=Battery backup unit/CV Hlth=Health|Safe=Safe-mode boot|CertProv-Certificate Provision mode Chrg=Charging | MsngCbl=Cable Failure ASO : === ---------------------------------------------------- Ctl Cl SAS MD R6 WC R5 SS FP Re CR RF CO CW HA SSHA ---------------------------------------------------- 0 X U X U U U X X X X X X X X X ---------------------------------------------------- Ctl=Controller Index|Cl=Cluster|MD=Max Disks|WC=Wide Cache|SS=Safe Store|FP=Fast Path Re=Recovery|CR=CacheCade(Read)|RF=Reduced Feature Set|CO=Cache Offload CW=CacheCade(Read/Write)|X=Not Available/Not Installed|U=Unlimited|T=Trial |HA=High Availability |SSHA=Single server High Availability
./storcli64 /c0 /e252 /sall show
./storcli64 /c0 /e252 /sall show
CLI Version = 007.1513.0000.0000 Apr 01, 2021
Operating system = Linux 3.10.0-1160.25.1.el7.x86_64
Controller = 0
Status = Success
Description = Show Drive Information Succeeded.
Drive Information :
=================
------------------------------------------------------------------------------
EID:Slt DID State DG Size Intf Med SED PI SeSz Model Sp Type
------------------------------------------------------------------------------
252:0 29 Onln 0 278.464 GB SAS HDD N N 512B ST300MM0048 U -
252:1 28 Onln 0 278.464 GB SAS HDD N N 512B ST300MM0048 U -
252:2 27 Onln 1 5.456 TB SAS HDD N N 512B ST6000NM0034 U -
252:3 25 Onln 1 5.456 TB SAS HDD N N 512B ST6000NM0034 U -
252:4 26 Onln 1 5.456 TB SAS HDD N N 512B ST6000NM0034 U -
252:5 24 Onln 1 5.456 TB SAS HDD N N 512B ST6000NM0034 U -
252:6 23 Onln 1 5.456 TB SAS HDD N N 512B ST6000NM0034 U -
------------------------------------------------------------------------------
EID=Enclosure Device ID|Slt=Slot No.|DID=Device ID|DG=DriveGroup
DHS=Dedicated Hot Spare|UGood=Unconfigured Good|GHS=Global Hotspare
UBad=Unconfigured Bad|Sntze=Sanitize|Onln=Online|Offln=Offline|Intf=Interface
Med=Media Type|SED=Self Encryptive Drive|PI=Protection Info
SeSz=Sector Size|Sp=Spun|U=Up|D=Down|T=Transition|F=Foreign
UGUnsp=UGood Unsupported|UGShld=UGood shielded|HSPShld=Hotspare shielded
CFShld=Configured shielded|Cpybck=CopyBack|CBShld=Copyback Shielded
UBUnsp=UBad Unsupported|Rbld=Rebuild
查看磁碟初始化
./storcli64 /c0/v1 show bgi CLI Version = 007.1513.0000.0000 Apr 01, 2021 Operating system = Linux 3.10.0-1160.25.1.el7.x86_64 Controller = 0 Status = Success Description = None VD Operation Status : =================== ------------------------------------------------------- VD Operation Progress% Status Estimated Time Left ------------------------------------------------------- 1 BGI 46 In progress 5 Hours 38 Minutes ------------------------------------------------------- 一些常用指令 ./storcli64 /c0/v1 show all
九、StorClI Reference Manual
https://docs.broadcom.com/doc/12352476
StorCLI64
List of commands:
Commands Description
add Adds/creates a new element to controller like VD,Spare..etc
delete Deletes an element like VD,Spare
show Displays information about an element
set Set a particular value to a property
get Get a particular value to a property
compare Compares particular value to a property
start Start background operation
stop Stop background operation
pause Pause background operation
resume Resume background operation
download Downloads file to given device
expand expands size of given drive
insert inserts new drive for missing
transform downgrades the controller
reset resets the controller phy
split splits the logical drive mirror
/cx Controller specific commands
/ex Enclosure specific commands
/sx Slot/PD specific commands
/vx Virtual drive specific commands
/dx Disk group specific commands
/fall Foreign configuration specific commands
/px Phy specific commands
/lnx Lane specific commands
/[bbu|cv] Battery Backup Unit, Cachevault commands
Other aliases : cachecade, freespace, sysinfo
/cx = Controller ID
/vx = Virtual Drive Number.
/ex = Enclosure ID
/sx = Slot ID
storcli /c0/v1 set wrcache=wt

[root@starfish abc]# storcli /c0 download file=/home/abc/92609280.rom
Download Completed.
Flashing image to adapter...
CLI Version = 007.1513.0000.0000 Apr 01, 2021
Operating system = Linux 3.10.0-1160.25.1.el7.x86_64
Controller = 0
Status = Success
Description = F/W Flash Completed. Please reboot the system for the changes to take effect
Current package version = 12.13.0-0154
New package version = 12.15.0-0248
./MegaCli64 -adpbbucmd -aAll
BBU status for Adapter: 0
BatteryType: iBBU08
Voltage: 9484 mV
Current: 0 mA
Temperature: 26 C
BBU Firmware Status:
Charging Status : None
Voltage : OK
Temperature : OK
Learn Cycle Requested : No
Learn Cycle Active : No
Learn Cycle Status : OK
Learn Cycle Timeout : No
I2c Errors Detected : No
Battery Pack Missing : No
Battery Replacement required : No
Remaining Capacity Low : No
Periodic Learn Required : No
Transparent Learn : No
storcli /c0/e252/s0 show rebuild
CLI Version = 007.1513.0000.0000 Apr 01, 2021
Operating system = Linux 3.10.0-1160.25.1.el7.x86_64
Controller = 0
Status = Success
Description = Show Drive Rebuild Status Succeeded.
------------------------------------------------------
Drive-ID Progress% Status Estimated Time Left
------------------------------------------------------
/c0/e252/s0 46 In progress -
------------------------------------------------------
storcli /c0 set alarm=off
CLI Version = 007.1513.0000.0000 Apr 01, 2021
Operating system = Linux 3.10.0-1160.25.1.el7.x86_64
Controller = 0
Status = Success
Description = None
Controller Properties :
=====================
----------------
Ctrl_Prop Value
----------------
Alarm OFF
----------------
Hot Spare Drive Commands
The following commands create and delete hot spare drives:
storcli /cx[/ex]/sx add hotsparedrive
storcli /cx/[ex]/sx delete hotsparedrive
Input example:
storcli /c0/e252/s2 add hotsparedrive
This command sets the drives /c0/e252/s2 as Global Hot spare.
PD LIST :
=======
------------------------------------------------------------------------------
EID:Slt DID State DG Size Intf Med SED PI SeSz Model Sp Type
------------------------------------------------------------------------------
252:0 21 Onln 0 278.464 GB SAS HDD N N 512B ST300MM0006 U -
252:1 22 Onln 0 278.464 GB SAS HDD N N 512B ST300MM0006 U -
252:2 24 GHS - 278.464 GB SAS HDD N N 512B ST300MM0006 U -
252:3 23 UGood - 278.464 GB SAS HDD N N 512B ST300MM0048 U -
252:4 17 Onln 1 278.464 GB SAS HDD N N 512B ST300MM0048 U -
252:5 20 Onln 1 278.464 GB SAS HDD N N 512B ST300MM0048 U -
252:6 18 Onln 1 278.464 GB SAS HDD N N 512B ST300MM0048 U -
252:7 19 Onln 1 278.464 GB SAS HDD N N 512B ST300MM0048 U -
------------------------------------------------------------------------------
storcli /c0/e252/s2,3 add hotsparedrive dgs=0,1
CLI Version = 007.1513.0000.0000 Apr 01, 2021
Operating system = Linux 4.18.0-305.3.1.el8.x86_64
Controller = 0
Status = Success
Description = Add Hot Spare Succeeded.
PD LIST :
=======
-------------------------------------------------------------------------------
EID:Slt DID State DG Size Intf Med SED PI SeSz Model Sp Type
-------------------------------------------------------------------------------
252:0 21 Onln 0 278.464 GB SAS HDD N N 512B ST300MM0006 U -
252:1 22 Onln 0 278.464 GB SAS HDD N N 512B ST300MM0006 U -
252:2 24 DHS 0,1 278.464 GB SAS HDD N N 512B ST300MM0006 U -
252:3 23 DHS 0,1 278.464 GB SAS HDD N N 512B ST300MM0048 U -
252:4 17 Onln 1 278.464 GB SAS HDD N N 512B ST300MM0048 U -
252:5 20 Onln 1 278.464 GB SAS HDD N N 512B ST300MM0048 U -
252:6 18 Onln 1 278.464 GB SAS HDD N N 512B ST300MM0048 U -
252:7 19 Onln 1 278.464 GB SAS HDD N N 512B ST300MM0048 U -
-------------------------------------------------------------------------------
Locate Drives Commands
storcli /cx[/ex]/sx start locate
storcli /cx[/ex]/sx stop locate
Set Drive State Commands
storcli /cx[/ex]/sx set jbod
storcli /cx[/ex]/sx set good [force]
storcli /cx[/ex]/sx set offline
storcli /cx[/ex]/sx set online
十、replace raid hdd
1. Set the failed drive as Offline –> ‘./storcli64 /cx/ey/sz set offline’
2. Set the failed drive as Missing –> ‘./storcli64 /cx/ey/sz set missing’
3. Spindown the failed drive –> ‘./storcli64 /cx/eall/sy spindown’
4. Remove the failed drive and replace it with a new drive (same model)
5. The rebuild should start automatically (If configured) and can be monitored –> ‘./storcli64 /cx/eall/sall show rebuild’
[root@starfish ~]# storcli /c0/e252/s7 set offline
CLI Version = 007.1513.0000.0000 Apr 01, 2021
Operating system = Linux 3.10.0-1160.25.1.el7.x86_64
Controller = 0
Status = Success
Description = Set Drive Offline Succeeded.
[root@starfish ~]# storcli /c0/e252/s7 set missing
CLI Version = 007.1513.0000.0000 Apr 01, 2021
Operating system = Linux 3.10.0-1160.25.1.el7.x86_64
Controller = 0
Status = Success
Description = Set Drive Missing Succeeded.
[root@starfish ~]# storcli /c0/e252/s7 spindown
CLI Version = 007.1513.0000.0000 Apr 01, 2021
Operating system = Linux 3.10.0-1160.25.1.el7.x86_64
Controller = 0
Status = Success
Description = Spin Down Drive Succeeded.
十一、show rebuild
./storcli64 /c0 /eall /sall show rebuild

十二、bbu show all
./storcli64 /c0/bbu show all
