Introduction

This article explains the usage of the LSI RAID controller administration programm. You can find it on the Hetzner Downloads Site.

The access data for this area can be found in the order completion email 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.

The status of the RAID may be obtained 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

Exit Code: 0x00

The status of the drives may be obtained 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, e.g. using:

megacli -PDList -aAll | egrep “Enclosure Device ID:|Slot Number:|Inquiry Data:|Error Count:|state” Setting up a hardware-based RAID

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

megacli -CfgLdDel -Lall -aAll

To delete everything (incl. eg. 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, they can be set up via:

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 an additional drive is installed 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 onProperties. Here the drive can be configured either as a dedicated hot spare for an array or as a global hot spare for all arrays. This is also possible via 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, it can be queried and created on a logical device:

root@rescue ~ # megacli -AdpBootDrive -get -a0

Adapter 0: No Virtual drive or Physical Drive is configured as boot drive.

Exit Code: 0x00

root@rescue ~ # megacli -AdpBootDrive -set -L0 -a0

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

Exit Code: 0x00

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:

root@rescue ~ # 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). This can be checked with PDList. If the status of the drive is Unconfigured (bad), it will first need to be made usable as follows:

root@rescue ~ # 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
root@rescue ~ # megacli -CfgForeign -Scan -a0

There are 1 foreign configuration(s) on controller 0.

Exit Code: 0x00
root@rescue ~ # megacli -CfgForeign -Clear -a0

Foreign configuration 0 is cleared on controller 0.

Exit Code: 0x00
 root@rescue ~ # megacli -PDMakeGood -PhysDrv [245:3] -a0

If the drive is good, it can now replace the missing drive. To do this the array and the position which are to be replaced need to be specified. These numbers may be obtained 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]”):

root@rescue ~ # megacli -PdReplaceMissing -PhysDrv[245:3] -array0 -row4 -a0
Adapter: 0: Missing PD at Array 0, Row 4 is replaced.
Exit Code: 0x00
root@rescue ~ # megacli -PDRbld -Start -PhysDrv[245:3] -a0
Started rebuild progress on device(Encl-245 Slot-3)
Exit Code: 0x00
root@rescue ~ # 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, eg. for the first drive. First of all, the device id needs to be determined with the megacli tool:

# megacli -pdlist -a0| grep 'Device Id' Device Id: 4 Device Id: 5

This can now be specified as a megaraid option, for example:

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

Depending on the operating system, an upgrade of the smartmontools or the kernel may be necessary. 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

With a firmware update, if one has been provided by the manufacturer of the controller, the firmware of your controller is kept up-to-date and known bugs are fixed and even new functions added.

Before you perform a firmware update, we always recommend you backup your data and the configuration of the RAID controller, to avoid a potential data loss.

A guide to backing up and then restoring the configuration of the controller can be found further up. 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 the case 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, an interim update may be required (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. The path to the previously saved firmware file (.rom file) mr12.12.0-0090.rom must be adjusted accordingly.

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. The path to the previously saved firmware file (.rom file) mr2108fw.rom must be adjusted accordingly.

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

Finally, 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 possibilities on your server with an LSI hardware RAID controller. You should have configured it to your liking by now.