Configuring LSI MegaRAID with MegaCLI

This article is part of a series on building out a low cost VMWare lab environment.

Working with old hardware has its challenges. Finding vendor drivers and documentation is challenging. Websites are updated so links on the Internet no longer work. Companies are acquired and product information is not integrated into into new websites or is not done well.

And sometimes things just don't work.

In the past I have been able to configure my LSI RAID card using WebBIOS, but for some reason on my HP Z220 the WebBIOS for my LSI 9260-8i would not load. I searched on the Internet for a solution. Several articles indicated that this could be resolved by hitting CTRL-H when prompted by the LSI card at boot and then manually selecting the RAID controller from the BIOS boot menu. I tried this several times without success.

At this point I was stuck. I could either build a Linux or Windows boot drive with LSI graphical management tool or a DOS boot drive with the MegaCLI tool. I was not keen about either. Getting Windows to run off a USB is a bit of a pain. Linux is easier, but I was not sure I could get the graphical configuration tool to run. Building a DOS boot drive is easy enough and my previous experience with the MegaRAID pre-boot command line interface was pretty bad.

So down the rabbit hold I went.

I had used the MegaCLI tool a little bit before and it was kind of a pain. The documentation kinda sucks. Also in the preboot environment there are no tools for paging information (or at least none that I could find), so you would run a command and pages of information would fly up the screen with no easy way to examine the necessary details. Grr.

And still this seemed like the best option.

Building a DOS boot USB was easy. I used RUFUS. It has an option to build a FreeDOS boot image. Unfortunately, it just builds a boot drive with no tools like edit or more. I spent several hours looking for a more complete DOS boot environment which I could install onto a USB drive but I was unsuccessful. Eventually, I just stuck with the RUFUS FreeDOS boot and dug arounds the bowels of the Internet to find the tools I needed (more.exe).

I took the opportunity to grab the latest firmware for the RAID controller and copied that and the MegaCLI.exe to my FreeDOS boot drive.

Upgrading the firmware

Upgrading the firmware was pretty straight forward.

I booted the system using the FreeDOS boot USB and then ran the command:

MegaCLI -adpfwflash -f mr2108fw.rom -a0

The -f indicates the firmware ROM file

The -a indicates the adapter ID, which in most cases should be zero unless you have multiple RAID cards in your system.

I rebooted the system to insure that the new firmware was loaded and then started work on configuring the drives.

Configuring the RAID controller

The MegaCLI command interface is not the easiest command line tool I have ever used. The flags are overly verbose and the documentation is not organized in a way I find useful.

The first thing to do is get a list of the physical drives connected to the controller by running the command:

megacli -pdlist -a0 | more

-pdlist = physical drive list

-a# = RAID adapter ID

This generated several pages of information about the drives attached to the controller. Here is the output for just one drive. The complete output included the other five drives. You can see why a tool like more.exe is necessary.

Enclosure Device ID: 252
Slot Number: 0
Enclosure position: N/A
Device Id: 9
WWN: 50026b73310280b8
Sequence Number: 1
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0

Raw Size: 111.790 GB [0xdf94bb0 Sectors]
Non Coerced Size: 111.290 GB [0xde94bb0 Sectors]
Coerced Size: 111.281 GB [0xde90000 Sectors]
Sector Size:  0
Logical Sector Size:  0
Physical Sector Size:  0
Firmware state: Unconfigured(good), Spun Up
Device Firmware Level: BBF0
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x4433221103000000
Connected Port Number: 1(path0)
Inquiry Data: 50026B73310280B8    KINGSTON SVP200S37A120G                 502ABBF0
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: Foreign
Foreign Secure: Drive is not secured by a foreign lock key
Device Speed: 6.0Gb/s
Link Speed: 6.0Gb/s
Media Type: Solid State Device
Drive:  Not Certified
Drive Temperature : N/A
PI Eligibility:  No
Drive is formatted for PI information:  No
Drive's NCQ setting : N/A
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s
Drive has flagged a S.M.A.R.T alert : No

You only need two bits of information about each drive to create a logical drive:

  • Enclosure Device ID
  • Device Id

So I made note of the Enclosure ID and Device IDs and then tried the following command command to build a RAID 1 array:

megacli -cfgldadd -R1[252:0,252:3] a0

cfgldadd = configure logical drive add

R# = RAID Level

[252:0,252:3] = comma delimited of enclosure and device ids

Unfortunately, this did not work.

These drives had been used with another controller before and were considered foreign. The following command scans and shows foreign configuration on adapter 0.

megacli -cfgforeign -scan a0

and this command clears the foreign configuration.

megacli -cfgforeign -clear a0

once I cleared the foreign configuration information I was able to create new logical drives on the controller.

At some point I am going to gather all the configuration information together so others don't have to invest the time I did to figure this all out.