LSI RAID Controller

Last change on 2023-01-30 • Created on 2020-03-19 • ID: RO-26143

Introduction

This article explains how to use the LSI RAID controller administration programm. You can find it on the Hetzner Downloads Site.

You can find the login details for this area in the order completion email that we sent you for your dedicated root server. When downloading the program, please make sure to read the license agreement.

  • The megacli tool is used for managing the controller via the command-line interface. (Note: The RPM installs this in /opt/MegaRAID/MegaCli/).
  • The MegaRAID Storage Manager (MSM) tool is used for managing the controller via a graphical interface.

Reading the status of the hardware-based RAID

To read the status of the LSI RAID Controller, the LSI megacli command-line tool needs to be installed. This is already pre-installed in the Hetzner Rescue-System.

You can get the status of the RAID by using the following command (show all logical devices on all controllers):

megacli -LDInfo -Lall -Aall

Example RAID 1:

Adapter 0 -- Virtual Drive Information:
Virtual Disk: 0 (Target Id: 0)
Name:
RAID Level: Primary-1, Secondary-0, RAID Level Qualifier-0
Size:697.560 GB
State: Optimal
Stripe Size: 64 KB
Number Of Drives:2
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
Access Policy: Read/Write
Disk Cache Policy: Enabled
Encryption Type: None

You can get the status of the drives by using the following command:

megacli -PDList -Aall

As this command also generates a quantity of useless information, it is advisable to filter the output, for example, by using:

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

Setting up a hardware-based RAID

Before you can start setting up the array, you may need to delete the previous configuration. To just delete the logical drive, you can use CfgLdDel:

megacli -CfgLdDel -Lall -aAll

To delete everything (including, for example, cache behaviour), use Configuration Clear:

megacli -CfgClr -aAll

Usable drives must be in an Unconfigured (good) status (see above). If these are in Unconfigured (bad) status, you can set them up using:

megacli -PDMakeGood -PhysDrv[<Enclosure#>:<Slot#>] -a0

Syntax:

megacli -CfgLdAdd -r<RAID#> [E0:S0,E1:S1,...] [WT|WB] [NORA|RA] [Direct|Cached] -sz<Size> [-sz<Size>]

RAID 0, 1 or 5

For "r1", enter "r0" or "r5" correspondingly (HDDs on Enclosure 252, Port 0 and 1, WriteBack on, ReadCache on adaptive, Cache also enabled without BBU):

megacli -CfgLdAdd -r1 [252:0,252:1] WB RA Direct CachedBadBBU -a0

Set up RAID 0, 1 or 5 as above with a size of 20 GB:

megacli -CfgLdAdd -r1 [252:0,252:1] WB RA Direct CachedBadBBU -sz10GB -a0

RAID 10

megacli -CfgSpanAdd -r10 -Array0[252:0,252:1] -Array1[252:2,252:3] WB RA Direct CachedBadBBU -a0

Expanding an existing array

After you have installed an additional drive, the desired volume is reconfigured accordingly. Here is an example of adding a drive to a RAID 5:

megacli -LDRecon -Start -r5 -Add -PhysDrv[252:3] -L0 -a0

Using the drives as JBOD

The LSI MegaRAID 9260 controller does not support JBOD mode, which would provide direct passthrough of the drives. However, it is possible to configure each drive as a RAID 0:

megacli -CfgEachDskRaid0 WB RA Direct CachedBadBBU -a0

Setting up a drive as a hot spare

Select an unconfigured good drive from the "Drives" menu and click on Properties. Here, you can configure the drive either as a dedicated hot spare for an array or as a global hot spare for all arrays. You can also do this using the megacli tool

  • As a global hotspare:

    megacli -PDHSP -Set -PhysDrv[252:2] -a0
  • As a dedicated hotspare for Array0:

    megacli -PDHSP -Set -Dedicated -Array0 -PhysDrv[252:2] -a0
  • Remove the hotspare status:

    megacli -PDHSP  -Rmv -PhysDrv[252:2] -a0

Creating a bootable array

If the array is not bootable, you can query it and create it on a logical device:

megacli -AdpBootDrive -get -a0

Adapter 0: No Virtual drive or Physical Drive is configured as boot drive.
megacli -AdpBootDrive -set -L0 -a0

Boot Virtual Drive is set to #0 (target id #0) on Adapter 0

Backing up and restoring the configuration of the controller

To save the configuration of the controller and all arrays:

megacli -CfgSave -f raidcfg.txt -a0

To restore the configuration of the controller:

megacli -CfgRestore -f raidcfg.txt -a0

Replacing a drive in an array if the rebuild does not start automatically

The status of the new drive should be Unconfigured (good). You can this with PDList. If the status of the drive is Unconfigured (bad), you first need to make it usable as follows:

megacli -PDList -a0 | grep Firmware

Firmware state: Online, Spun Up
Device Firmware Level: CC45
Firmware state: Online, Spun Up
Device Firmware Level: CC45
Firmware state: Unconfigured(bad), Spun Up
Device Firmware Level: CC45
Firmware state: Online, Spun Up
Device Firmware Level: CC45
megacli -CfgForeign -Scan -a0

There are 1 foreign configuration(s) on controller 0.
megacli -CfgForeign -Clear -a0

Foreign configuration 0 is cleared on controller 0.
megacli -PDMakeGood -PhysDrv [245:3] -a0

If the drive is good, it can now replace the missing drive. To do this, you need to specify the array and the position which are going to be replaced. You can get these numbers, for example, from megacli -CfgDsply -a0. If a drive is missing in an array, the entry Physical Disk: will show up, but no further information will be displayed. In the example, the fourth drive of the first array Array0 is now exchanged with the drive in Enclosure 245 Slot 3 ("PhysDrv[245:3]"):

megacli -PdReplaceMissing -PhysDrv[245:3] -array0 -row4 -a0

Adapter: 0: Missing PD at Array 0, Row 4 is replaced.
megacli -PDRbld -Start -PhysDrv[245:3] -a0

Started rebuild progress on device(Encl-245 Slot-3)
megacli -PDRbld -ShowProg -PhysDrv [245:3] -aAll

Rebuild Progress on Device at Enclosure 245, Slot 3 Completed 1% in 0 Minutes.

Reading the SMART values of the drive in RAID

The use of smartmontools enables direct access to the physical drive behind the controller, for example, for the first drive. First of all, you need to determine the device id using the megacli tool:

megacli -pdlist -a0| grep 'Device Id'

Device Id: 4
Device Id: 5

You can now specify this as a megaraid option, for example:

smartctl -d sat+megaraid,4 -a /dev/sda

Depending on the operating system, you may need to upgrade the smartmontools or the kernel.

RAID Configuration empty after reboot

In rare cases, once the server is rebooted, no configuration is found when the RAID array is created for the first time.

The configuration has to be created twice in the Rescue System in order to solve the problem.

RAID 1 Example:

  • Create

    megacli -CfgLdAdd -r1 [252:0,252:1] WB RA Direct CachedBadBBU -a0
  • Delete (in this case everything)

    megacli -CfgLdDel -Lall -aAll
  • Create Again

    megacli -CfgLdAdd -r1 [252:0,252:1] WB RA Direct CachedBadBBU -a0

Firmware update

Firmware updates from the manufacturer (if the manufacturer provides any) help to keep your controller's firmware up to date, provide fixes for known bugs, and add new functions.

Before you perform a firmware update, we always recommend you first back up your data and the RAID controller configuration to avoid any potential data loss.

You can find a guide to backing up and then restoring the controller configuration above.

Read the RAID controller model / FW version

To read the status of the LSI RAID controller, the command line tool megacli must be installed. This is already pre-installed in the Rescue System.

Command - syntax:

megacli -AdpAllInfo -aAll

Output example:

Versions
================
Product Name : LSI MegaRAID SAS 9260-4i
Serial No: SV52117135
FW Package Build: 12.15.0-0205

Perform a RAID controller FW update

Depending on the version of the firmware currently installed on the controller, you may need to do an interim update (only with firmware versions older than 12.12.0-0090).

If the firmware version is older than the firmware version 12.12.0-0090, please carry out an interim update to firmware version 12.12.0-0090. This update is available for download on the Hetzner mirror.

Save the firmware file on your server and run the following command to update the firmware version to, in this example, 12.12.0-0090. You need to adjust the path to the previously saved firmware file (.rom file) mr12.12.0-0090.rom.

Please refer to the readme file of the firmware update for the appropriate command. In this example, it reads as follows:

megacli -adpfwflash -f mr12.12.0-0090.rom -a0

If no interim update is necessary, you can use the following link to search the manufacturer's support page for the latest available firmware for the RAID controller.

Manufacturer support documents and download.

As before, save the firmware file on your server and run the following command to update the firmware version to, in this example, 2108fw. You need to adjust the path to the previously saved firmware file (.rom file) mr2108fw.rom .

Please refer to the readme file of the firmware update for the appropriate command. In this example, it reads as follows:

Command – syntax:

megacli -adpfwflash -f mr2108fw.rom -a0

Check the RAID controller firmware update

Lastly, you can check the installed firmware version.

Command – syntax:

megacli -AdpAllInfo -aAll

Output example:

Versions
================
Product Name : LSI MegaRAID SAS 9260-4i
Serial No: SV52117135
FW Package Build: 12.15.0-0205

Conclusion

This article demonstrates different RAID configuration options on your server with an LSI hardware RAID controller. By now, you have hopefully configured it to your liking.

Table of Contents