LSI megaraid configuration

Page content

HowTo configure LSI megaraid using the CLI.

Show adapter state

megacli -AdpAllInfo -aAll

Show physical drives

megacli -PDList -aAll |
  egrep "Enclosure Device ID:|Slot Number:|Inquiry Data:|Error Count:|state"

Delete all logical drives CAUTION!

megacli -CfgLdDel -Lall -aAll
megacli -CfgClr -aAl

Create a logical RAID 5 drive using 4 physical drives

megacli -CfgLdAdd -r5 [252:0,252:1,252:2,252:3] WB RA Direct CachedBadBBU -a0
megacli -AdpBootDrive -set -L0 -a0
megacli -AdpBootDrive -get -a0
megacli -LDInfo -Lall -Aall

Example output:

Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name                :
RAID Level          : Primary-5, Secondary-0, RAID Level Qualifier-3
Size                : 669.187 GB
Sector Size         : 512
Is VD emulated      : No
Parity Size         : 223.062 GB
State               : Optimal
Strip Size          : 256 KB
Number Of Drives    : 4
Span Depth          : 1
Default Cache Policy: WriteBack, ReadAhead, Direct, Write Cache OK if Bad BBU
Current Cache Policy: WriteBack, ReadAhead, Direct, Write Cache OK 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
Is VD Cached: No

See also the Hetzner tutorial.

Create a simple volume

pvcreate /dev/sda3
vgcreate vg1 /dev/sda3
lvcreate -l +100%FREE vg1
mkfs.ext4 /dev/mapper/vg1-lvol0
mkdir /srv

add filesystem to /etc/fstab:

/dev/mapper/vg1-lvol0 /srv ext4 noatime,nodiratime,commit=60,barrier=0 0 2

and mount it …

mount /srv