Skip to main content

MegaRAID - MegaCLI on Linux

756 words·
MegaRAID MegaCLI Linux Smartctl

A small tutorial to list disks, disk statistics and RAID configurations with MegaCLI.

Install MegaCLI
#

Prerequisites

# Install Zip Tool
apt install unzip

# Install Alien Package Converter
apt install alien

Install MegaCLI

# Download MegaCLI
wget https://docs.broadcom.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/8-07-14_MegaCLI.zip

# Unzip
unzip 8-07-14_MegaCLI.zip

# CD into extracted directory
cd Linux

# Convert from RPM (RedHat) to Debian
sudo alien MegaCli-8.07.14-1.noarch.rpm

# Install Package
sudo dpkg -i megacli_8.07.14-2_all.deb

# Create Symbolic Link
/bin/ln -s /opt/MegaRAID/MegaCli/MegaCli64 /usr/bin/megacli

Overview
#

# List MegaCLI Version
sudo megacli -v

# List overall information about RAID Controller and Configuration
sudo megacli -AdpAllInfo -aALL

List Physical Devices
#

# List physical disks that are managed by MegaRAID 
sudo megacli -PDList -aALL
  • -PDList Stands for Physical Drive List. It lists all the physical drives
  • -aALL Specifies that the command should be executed on all the adapters in the system.

Shell Output:

Adapter #0

Enclosure Device ID: 8
Slot Number: 0
Drive's position: DiskGroup: 0, Span: 0, Arm: 0
Enclosure position: 1
Device Id: 14
WWN: 55cd2e4150c11a16
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SATA

Raw Size: 447.130 GB [0x37e436b0 Sectors]
Non Coerced Size: 446.630 GB [0x37d436b0 Sectors]
Coerced Size: 446.625 GB [0x37d40000 Sectors]
Sector Size:  512
Logical Sector Size:  512
Physical Sector Size:  4096
Firmware state: Online, Spun Up
Commissioned Spare : No
Emergency Spare : No
Device Firmware Level: 0100
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5001c450282e6680
Connected Port Number: 0(path0)
Inquiry Data: PHYF908502RM480BGN  INTEL SSDSC2KB480G8                     XCV10100
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None
Device Speed: 6.0Gb/s
Link Speed: 6.0Gb/s
Media Type: Solid State Device
Drive:  Not Certified
Drive Temperature :14C (57.20 F)
PI Eligibility:  No
Drive is formatted for PI information:  No
PI: No PI
Drive's NCQ setting : Enabled
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s
Drive has flagged a S.M.A.R.T alert : No



Enclosure Device ID: 8
Slot Number: 1
Drive's position: DiskGroup: 0, Span: 0, Arm: 1
Enclosure position: 1
Device Id: 15
WWN: 55cd2e4150e3cb95
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SATA

Raw Size: 447.130 GB [0x37e436b0 Sectors]
Non Coerced Size: 446.630 GB [0x37d436b0 Sectors]
Coerced Size: 446.625 GB [0x37d40000 Sectors]
Sector Size:  512
Logical Sector Size:  512
Physical Sector Size:  4096
Firmware state: Online, Spun Up
Commissioned Spare : No
Emergency Spare : No
Device Firmware Level: 0110
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5001c450282e6681
Connected Port Number: 0(path0)
Inquiry Data: PHYF921502NX480BGN  INTEL SSDSC2KB480G8                     XCV10110
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None
Device Speed: 6.0Gb/s
Link Speed: 6.0Gb/s
Media Type: Solid State Device
Drive:  Not Certified
Drive Temperature :17C (62.60 F)
PI Eligibility:  No
Drive is formatted for PI information:  No
PI: No PI
Drive's NCQ setting : Enabled
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s
Drive has flagged a S.M.A.R.T alert : No
  • Adapter #0 Refers to the first RAID Controller of the system
  • Slot Number: 0 Refers to physical location / server-bay of the disk
  • Device Id: 14 Device ID on RAID Controller

SmartCTL
#

Use the device ID from the sudo megacli -PDList -aALL command.

# List all storage devices
`smartctl --scan`

# List SMART information
smartctl -a -d megaraid,14 /dev/sda
  • -a All SMART Information: Status, summary, attributes
  • -d Specify device type

List Logical Drives (RAIDs)
#

megacli -LDInfo -L0 -a0
  • -LDInfo List information about logical drive (RAID array)
  • -L0 Logical drive 0 (First RAID)
  • -a0 Specify Adapter / RAID Controller

Shell Output:

Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name                :Unit00
RAID Level          : Primary-1, Secondary-0, RAID Level Qualifier-0
Size                : 446.625 GB
Sector Size         : 512
Is VD emulated      : Yes
Mirror Data         : 446.625 GB
State               : Optimal
Strip Size          : 256 KB
Number Of Drives    : 2
Span Depth          : 1
Default Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None
Bad Blocks Exist: No
PI type: No PI

Is VD Cached: No

Exit Code: 0x00
  • RAID Level: Primary-1 = RAID 1

MegaRAID Battery
#

# List details about MegaRAID Battery
sudo megacli -AdpBbuCmd -aALL