Create hardware raid on HP via hpacucli

Configuring a new hardware raid on a HP server can be done comfortably from the Linux command line without restarting the server. HP provides a small command line tool for this job. The following shows how this tool can be used to create a new raid.

Finding the documentation

HP’s utility is called “hpacucli” which stands for the “HP Command Line Array Configuration Utility”.

The man page is very short and refers to a text file at /opt/compaq/hpacucli/bld/hpacucli-VERSION.noarch.txt for documentation. This document simply does not exist. The man page fails to state that the “VERSION” in the file name need to be replaced with the version of the utility. In this directory a file matching this description exists. The file /opt/compaq/hpacucli/bld/hpacucli-9.40-12.0.x86_64.txt fitting the description does not contain any helpful information either.

Instead, the help command needs to be executed step by step to go through the documentation.

$ hpacucli help

Show controller details

To address a specific controller to create the raid, the controller “slot” needs to be determined. This can be done using the following command. This command will address “all” controllers and show their status. The result is a list of controllers and their “slot”.

$ hpacucli controller all show

Smart Array P400 in Slot 1                (sn: BSLKM0I6SR74RS)

To list the physical drives connected to the controller, the command below will address the controller at “slot 1” and show “all” connected physical drives (“physicaldrive”). The output also shows the unassigned drives, as well as the drives assigned to a raid configuration.

$ hpacucli controller slot=1 physicaldrive all show

Smart Array P400 in Slot 1

   array A

      physicaldrive 2I:1:1 (port 2I:box 1:bay 1, SAS, 146 GB, OK)
      physicaldrive 2I:1:2 (port 2I:box 1:bay 2, SAS, 146 GB, OK)

   unassigned

      physicaldrive 1I:1:5 (port 1I:box 1:bay 5, SATA, 1 TB, OK)
      physicaldrive 1I:1:6 (port 1I:box 1:bay 6, SATA, 1 TB, OK)
      physicaldrive 2I:1:4 (port 2I:box 1:bay 4, SATA, 1 TB, OK)

Create the RAID drive

The documentation shown with “$ hpacucli help create” will assist in the creation of the RAID using the 3 unassigned disks. The RAID I will create on those disks will be a RAID 5.

The command contains as usual the command “controller” and the slot of the controller. The command “create” will instruct hpacucli to create a new raid. The create command needs additional parameters.

The type of device to be created “type=ld” where ld stands for “logical drive”

The drives which need to be passed as a list of drives. This can either be a list in the format “[box]:[bay],[box]:[bay],…” or “drives=allunassigned” which takes all unassigned disks for the raid to be created.

The raid level to create. The possible raid levels depends on the number of disks as the different raid levels need a different minimum number of disks.

The size of the logical drive to be created. The size is in MB but it is also possible to specify it as “max” which will use the maximum size possible for the raid type and the drives used.

With the 3 unassigned drives, a RAID 5 with theirĀ full capacity can be created with one of the following commands. The first one addresses all unassigned drives while the second one is addressing them directly but the result will be the same.

$ hpacucli controller slot=1 create type=ld drives=allunassigned raid=5 size=max
$ hpacucli controller slot=1 create type=ld drives=1:4,1:5,1:6 raid=5 size=max

To verify the new raid, the configuration can be shown with the following command.

$ hpacucli controller slot=1 show config

Smart Array P400 in Slot 1                (sn: BSLKM0I6SR74RS)

   array A (SAS, Unused Space: 0  MB)


      logicaldrive 1 (136.7 GB, RAID 1, OK)

      physicaldrive 2I:1:1 (port 2I:box 1:bay 1, SAS, 146 GB, OK)
      physicaldrive 2I:1:2 (port 2I:box 1:bay 2, SAS, 146 GB, OK)

   array B (SATA, Unused Space: 0  MB)


      logicaldrive 2 (1.8 TB, RAID 5, OK)

      physicaldrive 1I:1:5 (port 1I:box 1:bay 5, SATA, 1 TB, OK)
      physicaldrive 1I:1:6 (port 1I:box 1:bay 6, SATA, 1 TB, OK)
      physicaldrive 2I:1:4 (port 2I:box 1:bay 4, SATA, 1 TB, OK)

As the output shows the RAID 5 has been created with the full size of the 3 drives. As RAID 5 loses the capacity of one disc in the logical drive size, the result of 3 drives with 1 TB results in a logical drive with 2 TB capacity.

infoAs disk manufacturers specify the drive size in TB while most operating system calculate in TiB. This means that 1 TB is calculated by the decimal “1.000.000.000.000 bytes” while TiB as the operating system is calculating it is calculated binary by 1024 and contains “1.099.511.627.776 bytes”. See Wikipedia Tebibyte for more details.

The 2 TB logical drive is only 1,8 TiB as the raid controller shows.

Use the new RAID drive

To verify that the new logical drive was detected by Linux, execute the following command. fdisk will list (-l option) all drives detected in the system.

$ fdisk -l 2>/dev/null 

Disk /dev/cciss/c0d0: 146.8 GB, 146778685440 bytes
255 heads, 63 sectors/track, 17844 cylinders, total 286677120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d0p1               1   286677119   143338559+  ee  GPT

...

Disk /dev/cciss/c0d1: 2000.3 GB, 2000342441984 bytes
255 heads, 32 sectors/track, 478789 cylinders, total 3906918832 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa59273a9

I have removed some of the drives fdisk detects from the print out to reduce the output to what is important. The output shows the 2000 GB disk which represents the 2 TB logical drive.

The logical disk is now ready to be used. Keep in mind that this logical disc when it is created does not even have a partition table on it. Some partitioning tools might show an error or warning about the disc until you have created a partition table on it. With parted(8) and the “mklabel” command, a partition table can be created.

$ parted /dev/cciss/c0d1
GNU Parted 3.2
Using /dev/cciss/c0d1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
(parted) mklabel gpt
(parted) q
Information: You may need to update /etc/fstab.

The “gpt” stands for GUID Partition Table and is the type of partition table to be created on the disk.


Read more of my posts on my blog at https://blog.tinned-software.net/.

This entry was posted in Linux Administration and tagged , , , , , . Bookmark the permalink.