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

By thomas, 30 March, 2011
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

[root@server ~]# 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

List the logical devices

[root@server ~]# 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

[root@server ~]# MegaCli64 -CfgLdAdd -r0 [32:5,32:6,32:7] -a0 Adapter 0: Created VD 1 Adapter 0: Configured the Adapter!! Exit Code: 0x00 [root@server ~]# 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-)