MegaCli tool usage

Since the server's BIOS does not integrate Optional rom, Raid cannot be set graphically under the BIOS, and the
tool MegaCli can only be used under the OS

1. #View Disk Information

[root@localhost ~]# megacli -PDList -aALL |egrep 'Adapter|Enclosure|Slot|Firmware state'
Adapter #0
Enclosure Device ID: 252
Slot Number: 4
Enclosure position: N/A
Firmware state: Unconfigured(good), Spun Up
Enclosure Device ID: 252
Slot Number: 5
Enclosure position: N/A
Firmware state: Unconfigured(good), Spun Up
[root@localhost ~]# 

2. #Build Raid1
#megacli -CfgLdAdd -r1 [252:4,252:5] WB -a0 composes data
according to Enclosure Device ID 252 and Slot Number 4 5, r1 is raid 1 and a0 is Adapter number to
build Raid5
megacli -CfgLdAdd -r5 [41:0,41:1,41:2,41:3,41:4,41:5,41:6,41:7,41:8,41:9,41:10,41:11] WB Cached -a0

[root@localhost ~]# megacli -CfgLdAdd -r1 [252:4,252:5] WB -a0
                                     
Adapter 0: Created VD 0

Adapter 0: Configured the Adapter!!

Exit Code: 0x00

3. #View the raid card status of raid 1 after formation

[root@localhost ~]# megacli -ShowSummary -aALL 
                                     
System
	Operating System:  Linux version 4.19.90.S001.64.200410 
	Driver Version: 07.706.03.00-rc1
	CLI Version: 8.07.14

Hardware
        Controller
                 ProductName       : AVAGO MegaRAID SAS 9361-8i(Bus 0, Dev 0)
                 SAS Address       : 500605b010384be0
                 FW Package Version: 24.21.0-0017
                 Status            : Need Attention
        Enclosure
                 Product Id        : SGPIO           
                 Type              : SGPIO
                 Status            : OK

        PD 
                Connector          : Port 4 - 7<Internal>: Slot 4 
                Vendor Id          : ATA     
                Product Id         : HGST HUS722T2TAL
                State              : Online
                Disk Type          : SATA,Hard Disk Device
                Capacity           : 1.818 TB
                Power State        : Active

                Connector          : Port 4 - 7<Internal>: Slot 5 
                Vendor Id          : ATA     
                Product Id         : HGST HUS722T2TAL
                State              : Rebuild
                Disk Type          : SATA,Hard Disk Device
                Capacity           : 1.818 TB
                Power State        : Active
                Operation In Progress : Rebuild

Storage

       Virtual Drives
                Virtual drive      : Target Id 0 ,VD name 
                Size               : 1.818 TB
                State              : Degraded
                RAID Level         : 1 


Exit Code: 0x00

4. #View and turn on JBOD mode:

##megacli  -AdpGetProp -enablejbod -aALL     #查看JBOD是否开启
[root@localhost ~]# megacli  -AdpGetProp -enablejbod -aALL
                                     
Adapter 0: JBOD: Disabled

Exit Code: 0x00

##megacli -AdpSetProp -EnableJBOD -0 -aALL   #关闭JBOD
[root@localhost ~]# megacli -AdpSetProp -EnableJBOD -0 -aALL
                                     
Adapter 0: Set JBOD to Disable success.

Exit Code: 0x00

##megacli  -AdpSetProp -EnableJBOD -1 -aALL    #打开JBOD
[root@localhost ~]# megacli  -AdpSetProp -EnableJBOD -1 -aAlL
                                     
Adapter 0: Set JBOD to Enable success.

Exit Code: 0x00

5. #Firmware state: Unconfigured(bad) solution
megacli -PDMakeGood -PhysDrv[E:S] -a0 The firmware state will change from Unconfigured(bad) to Unconfigured(good), Spun Up

[root@localhost ~]# megacli -PDList -aALL |egrep 'Adapter|Enclosure|Slot|Firmware state'
Adapter #0
Enclosure Device ID: 252
Slot Number: 4
Enclosure position: N/A
Firmware state: Online, Spun Up
Enclosure Device ID: 252
Slot Number: 5
Enclosure position: N/A
Firmware state: Unconfigured(bad)  
[root@localhost ~]# megacli -PDMakeGood -PhysDrv[252:5] -a0
                                     
Adapter: 0: EnclId-252 SlotId-5 state changed to Unconfigured-Good.

Exit Code: 0x00
[root@localhost ~]# megacli -PDList -aALL |egrep 'Adapter|Enclosure|Slot|Firmware state'
Adapter #0
Enclosure Device ID: 252
Slot Number: 4
Enclosure position: N/A
Firmware state: Online, Spun Up
Enclosure Device ID: 252
Slot Number: 5
Enclosure position: N/A
Firmware state: Unconfigured(good), Spun Up
[root@localhost ~]# 

6. #View disk rebuild progress

[root@localhost ~]# megacli -PDRbld -showprog -physDrv [252:5] -a0
                                     
Rebuild Progress on Device at Enclosure 252, Slot 5 Completed 1% in 2 Minutes.

Exit Code: 0x00

7. #Turn off the buzzer alarm

megacli  -AdpSetProp AlarmDsbl -aALL       #永久关闭,重启后还是关闭
megacli  -AdpSetProp  -AlarmDsbl  –a0      #永久关闭,重启后还是关闭
megacli  -AdpSetProp  -AlarmSilence –a0    #临时关闭,重启又变成开启
megacli  -AdpSetProp  -Alarmenbl  –a0      #开启
megacli  -AdpgetProp  -Alarmdsply  –a0     #查看告警的状态

8. #Clear the configuration of the raid group

megacli  -cfgclr  -a0        #清除所有的raid组的配置

9. #View RAID status

megacli  -LDInfo -Lall -aALL     #查看RAID的状态

10. #View raid card information

megacli   -adpallinfo -a0

11. #View physical disk information

megacli -pdlist --aall

12. #View physical disk and logical disk information

megacli -LdPdInfo -aALL

Guess you like

Origin blog.csdn.net/qq_44777969/article/details/115207950
Recommended