creating a new logical drive with MegaCli on linux (MegaRaid SAS)

I have a system with megaraid and I needed to add a new logical drive. I wanted to do it without rebooting, so I started looking around. I got the MegaCLI from LSI's website and was dismayed by it's apparent lack of documentation.

I found this page on le-vert.net that explained how to do everything. Phew.

List the drives

[<a href="mailto:root@server">root@server</a> ~]# MegaCli64 -PDlist -a0 |grep -A1 "Enclosure Device"
Enclosure Device ID: 32
Slot Number: 0
--
Enclosure Device ID: 32
Slot Number: 1
--
Enclosure Device ID: 32
Slot Number: 2
--
Enclosure Device ID: 32
Slot Number: 3
--
Enclosure Device ID: 32
Slot Number: 4
--
Enclosure Device ID: 32
Slot Number: 5
--
Enclosure Device ID: 32
Slot Number: 6
--
Enclosure Device ID: 32
Slot Number: 7
</blockquote>

List the logical devices

[<a href="mailto:root@server">root@server</a> ~]# MegaCli64 -LDInfo -Lall -a0
Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name                :
RAID Level          : Primary-5, Secondary-0, RAID Level Qualifier-3
Size                : 544.5 GB
State               : Optimal
Strip Size          : 64 KB
Number Of Drives    : 5
Span Depth          : 1
Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Access Policy       : Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None

Create the device using the disk names

[<a href="mailto:root@server">root@server</a> ~]# MegaCli64 -CfgLdAdd -r0 [32:5,32:6,32:7] -a0
 
Adapter 0: Created VD 1
 
Adapter 0: Configured the Adapter!!
 
Exit Code: 0x00
[<a href="mailto:root@server">root@server</a> ~]# dmesg |tail
sdb: Write Protect is off
sdb: Mode Sense: 1f 00 00 08
SCSI device sdb: drive cache: write back
SCSI device sdb: 2927099904 512-byte hdwr sectors (1498675 MB)
sdb: Write Protect is off
sdb: Mode Sense: 1f 00 00 08
SCSI device sdb: drive cache: write back
 sdb: unknown partition table
sd 0:2:1:0: Attached scsi disk sdb
sd 0:2:1:0: Attached scsi generic sg3 type 0
The drive showed up right way, cool. 8-)

About the Author...

Slides from LISA 2019 Linux systems troubleshooting #LISA2019 https://t.co/D4dMKflK6R Tue Oct 29 05:59:30 +0000 2019

https://t.co/AGeihMALAv configuring grub2 with EFI Fri Sep 13 05:20:01 +0000 2019

I published a Thing on @thingiverse! https://t.co/IYpRyEb7Hz #thingalert Tue Jul 23 19:27:57 +0000 2019

Nokogiri install on MacOSX https://t.co/v3An0miW9L Fri Jul 12 15:06:49 +0000 2019

HTML email with plain mailer plugin on Jenkins https://t.co/Z6FSDMDjy8 Thu Jul 11 21:07:25 +0000 2019