Decoding RAID Level Discrepancies: MegaCli vs megasasctl Output Interpretation for Storage Engineers


7 views

When working with MegaRAID controllers, the command /opt/MegaCli -CfgDsply -a0 often produces confusing output regarding RAID levels. The typical output format:

RAID Level : Primary-1, Secondary-3, RAID Level Qualifier-0

This doesn't directly correspond to standard RAID terminology, leading many administrators to question whether they're actually running RAID 3 (which would be highly unusual in modern setups).

The correct interpretation is:

  • Primary-1: Indicates RAID 1 (mirroring) at the span level
  • Secondary-3: Means there are 3 spans in the array
  • Qualifier-0: Shows these spans are striped (RAID 0) together

This configuration actually describes a RAID 10 (1+0) setup with three mirrored pairs striped together. Here's how to verify this programmatically:

# Get detailed RAID configuration
/opt/MegaCli -LDInfo -Lall -aALL | grep -E "RAID Level|Number Of Drives|Span"

# Expected output for RAID 10:
RAID Level : Primary-1, Secondary-3, RAID Level Qualifier-0
Number Of Drives : 6
Span Depth : 2

For absolute certainty, combine MegaCli output with alternative tools:

# Using megasasctl for cross-verification
megasasctl | grep -A 5 "Virtual Drive"

# Sample expected output:
Virtual Drive 0:
  RAID Level: raid10
  Size: 5.46TB
  Number of Drives: 6

Here's a Python script to parse and translate MegaCli output:

import re

def interpret_raid_level(raw_output):
    match = re.search(r"Primary-(\d), Secondary-(\d),.*Qualifier-(\d)", raw_output)
    if not match:
        return "Unknown RAID configuration"
    
    primary, secondary, qualifier = map(int, match.groups())
    
    if primary == 1 and qualifier == 0:
        return f"RAID 10 ({secondary} spans)"
    elif primary == 0 and secondary == 0:
        return "RAID 0"
    elif primary == 1 and secondary == 0:
        return "RAID 1"
    elif primary == 5 and qualifier == 0:
        return "RAID 5"
    else:
        return f"Complex RAID (Primary-{primary}, Secondary-{secondary}, Qualifier-{qualifier})"

# Example usage:
mega_output = "RAID Level : Primary-1, Secondary-3, RAID Level Qualifier-0"
print(interpret_raid_level(mega_output))  # Output: RAID 10 (3 spans)
  • MegaCli uses non-standard terminology that combines span and RAID level information
  • Primary-1 + Qualifier-0 always indicates RAID 10 configuration
  • The Secondary number represents the number of spans (mirrored pairs) in RAID 10
  • Always cross-verify with physical disk count and alternative tools

For comprehensive monitoring, consider implementing regular checks that compare MegaCli output with your actual storage requirements to catch any configuration drift.


When running /opt/MegaCli -CfgDsply -a0, you might encounter this cryptic output:

RAID Level : Primary-1, Secondary-3, RAID Level Qualifier-0

At first glance, this appears contradictory - RAID 3 is rarely used in modern storage systems. Let's dissect what this actually means.

The syntax represents nested RAID levels in LSI's implementation:

  • Primary: The RAID level applied within each span (RAID 1 in this case)
  • Secondary: The number of spans (3 in this example)
  • Qualifier: The RAID level applied across spans (RAID 0 here)

This configuration translates to:

[ (RAID1) + (RAID1) + (RAID1) ] → RAID0

Which is effectively RAID 10 (1+0) when using two disks per RAID1 set, or a more complex nested RAID when using more disks.

Use this MegaCli command to validate physical disk arrangement:

/opt/MegaCli -PDList -aALL | egrep "Raw Size|Device ID"

And check virtual drive details:

/opt/MegaCli -LDInfo -LALL -aALL | grep -i "strip\|number"

For clearer output, consider using megasasctl (for newer SAS controllers):

megasasctl -d

Example output comparison:

MegaCli:   RAID Level : Primary-1, Secondary-3, RAID Level Qualifier-0
megasasctl: RAID10 (1+0) with 3 spans

Here's a bash script to interpret MegaCli output:

#!/bin/bash
RAID_INFO=$(/opt/MegaCli -CfgDsply -a0 | grep "RAID Level")

IFS=', ' read -r -a raid_parts <<< "$RAID_INFO"
primary=${raid_parts[2]#*-}
secondary=${raid_parts[4]#*-}
qualifier=${raid_parts[7]#*-}

case "$primary-$qualifier" in
   "1-0") echo "RAID 10 (1+0) with $secondary spans" ;;
   "0-1") echo "RAID 01 (0+1)" ;;
   "5-0") echo "RAID 50 with $secondary spans" ;;
   *) echo "Complex nested RAID configuration" ;;
esac

For modern systems, consider these alternatives:

  • storcli (successor to MegaCli)
  • ssacli (for HPE servers)
  • lsblk and mdadm (for software RAID)