scsi

the mysterious MegaCLI

I've inherited some Production Sun Fire X4470 boxes, which upon first look appeared to only have 2 x 140GB drives. Checking the purchase orders however, revealed that they should in fact have 4 x 140GB drives, a fact confirmed by “dmesg |grep scsi”.

These Sun Fire servers come with an internal 6Gb SAS PCIe RAID HBA which are managed via the LSI MegaRAID Management Suite. Unfortunately, the LSI website is a nightmare to navigate and has been re-arranged with no-redirects, requires a login and in general makes it very hard to find and download the MegaCLI utility.
I eventually found a working download link at http://www.lsi.com/downloads/Public/MegaRAID%20Common%20Files/8.02.16_MegaCLI.zip.

The zip file contains an RPM file, so if like myself, you run Debian, you'll need to run:
rpm2cpio MegaCli-8.02.16-1.i386.rpm | cpio -idmv
The binaries are statically compiled so actually run fine.

In this situation, it simply turned out my drives were setup as RAID 1 mirrors, which was easy to discern using:

./MegaCli64 -CfgDsply -aALL

I came across a couple of good cheat sheets for MegaCLI -
http://thatlinuxbox.com/blog/article.php/lsi-megaraid-megacli
http://www.theserve.co.uk/web-hosting-blog/megacli-commands
http://ftzdomino.blogspot.com/2009/03/some-useful-megacli-commands.html
http://tools.rapidsoft.de/perc/perc-cheat-sheet.html
http://www.5dollarwhitebox.org/drupal/node/82

For me, the most useful ones were:

#Physical Disk List
./MegaCli64 -PDList -aALL

#Physical Drive Info
./MegaCli64 -pdInfo -PhysDrv \[252:4\] -aALL |less

#Logical Disk Info
./MegaCli64 -LDInfo -LAll -aAll | less

# Config Display
./MegaCli64 -CfgDsply -aALL

# Config add Logical Drive
./MegaCli64 -CfgLdAdd -r0 \[252:4,252:5\] -a0

# Logical Drive Init
./MegaCli64 -LDInit -Start -L2 -a0

We installed another two drives in the machine, which i was able to bring online in a RAID 0 volume using:
./MegaCli64 -CfgLdAdd -r0 \[252:4,252:5\] -a0

However, even after having created this RAID 0 volume, my OS couldn't see it when using ‘fdisk -l‘ - i had to run
echo “- - -” > /sys/class/scsi_host/host0/scan
which forces a SCSI bus rescan, and made available the new drive.