≡ Menu

17 hpacucli Command Examples for Linux on HP Servers

HPACUCLI stands for HP Array Configuration Utility CLI.

As the name suggests, this utility is for HP servers.

Hpacucli is used to create, delete and repair the logical and physical drives on the smart array controllers in HP servers.

To use hpacucli, download and install the latest version of hpacucli rpm from the HP website on your Linux server.

1. Two ways to execute the command

When you type the command hpacucli, it will display a “=>” prompt as shown below where you can enter all the hpacucli commands explained in the article.

# hpacucli
HP Array Configuration Utility CLI 9.20.9.0
Detecting Controllers...Done.
Type "help" for a list of supported commands.
Type "exit" to close the console.
=> rescan

Or, if you don’t want to get to the hpacucli prompt, you can just enter the following directly in the Linux prompt. The following is exactly same as the above.

# hpacucli rescan

2. Display Controller and Disk Status

To display the detailed status of the controller and the disk status, execute the following command.

# hpacucli
=> ctrl all show config

Smart Array P410i in Slot 0 (Embedded)    (sn: 50014380101D61C0)

   array A (SAS, Unused Space: 0  MB)

      logicaldrive 1 (136.7 GB, RAID 1, OK)

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

   unassigned

      physicaldrive 1I:1:3 (port 1I:box 1:bay 3, SAS, 300 GB, OK)
      physicaldrive 1I:1:4 (port 1I:box 1:bay 4, SAS, 300 GB, OK)
      physicaldrive 2I:1:6 (port 2I:box 1:bay 6, SAS, 300 GB, OK)
      physicaldrive 2I:1:7 (port 2I:box 1:bay 7, SAS, 300 GB, OK)
      physicaldrive 2I:1:8 (port 2I:box 1:bay 8, SAS, 300 GB, OK)

   SEP (Vendor ID PMCSIERA, Model  SRC 8x6G) 250 (WWID: 50014380101D61CF)

In this example, as shown in the above output, we have total 7 physical drives. The first RAID group RAID 1 contains 2 physical drives and the remaining physical drives are not assigned to any of the logical drives.

3. View Controller Status

To display the status of just the controller, do the following. In this example, the controller is working perfectly without any issues.

=> ctrl all show status

Smart Array P410i in Slot 0 (Embedded)
   Controller Status: OK
   Cache Status: OK

4. View Drive Status

To display the status of the physical drive, do the following. In this example, we have two 146GB physical drives, and 5 300GB physical drives, and all are in perfect condition.

=> ctrl slot=0 pd all show status

   physicaldrive 1I:1:1 (port 1I:box 1:bay 1, 146 GB): OK
   physicaldrive 1I:1:2 (port 1I:box 1:bay 2, 146 GB): OK
   physicaldrive 1I:1:3 (port 1I:box 1:bay 3, 300 GB): OK
   physicaldrive 1I:1:4 (port 1I:box 1:bay 4, 300 GB): OK
   physicaldrive 2I:1:6 (port 2I:box 1:bay 6, 300 GB): OK
   physicaldrive 2I:1:7 (port 2I:box 1:bay 7, 300 GB): OK
   physicaldrive 2I:1:8 (port 2I:box 1:bay 8, 300 GB): OK

5. View Individual Drive Status

To display the detail status of a specific physical drive, do the following.

In this example, we like to know the status of “pd” (physical disk) in slot 0. The specific disk is “2I:1:6”, which we figured it out from the output of the previous command.

As shown in the output below, this displays the Serial Number, Make, Model, Size and Fireware version of this specific disk. This can be very helpful during troubleshooting.

=> ctrl slot=0 pd 2I:1:6 show detail

Smart Array P410i in Slot 0 (Embedded)

   unassigned

      physicaldrive 2I:1:6
         Port: 2I
         Box: 1
         Bay: 6
         Status: OK
         Drive Type: Unassigned Drive
         Interface Type: SAS
         Size: 300 GB
         Rotational Speed: 10000
         Firmware Revision: HPD4
         Serial Number: EB01PC416C4C1214
         Model: HP      EG0300FBDSP
         Current Temperature (C): 38
         Maximum Temperature (C): 56
         PHY Count: 2
         PHY Transfer Rate: 6.0Gbps, Unknown

6. View All Logical Drives

The following command will display all available logical drives on the system. As shown in the output below, we currently have only one logical drive in RAID 1 with total size of around 136GB.

=> ctrl slot=0 ld all show

Smart Array P410i in Slot 0 (Embedded)

   array A

      logicaldrive 1 (136.7 GB, RAID 1, OK)

7. Create New RAID 0 Logical Drive

Execute the following command to create a new logical drive using RAID 0 option.

=> ctrl slot=0 create type=ld drives=1I:1:3 raid=0

The above command creates a logical drive with the physical drives 1I:1:3 on RAID 0 configuration in slot 0.

8. Create New RAID 1 Logical Drive

Execute the following command to create a new logical drive using RAID 1 option.

=> ctrl slot=0 create type=ld drives=1I:1:3,1I:1:4 raid=1

The above command creates a logical drive with the two physical drives 1I:1:3 and 1I:1:4 on RAID 1 configuration in slot 0.

9. Create New RAID 5 Logical Drive

Execute the following command to create a new logical drive using RAID 5 option.

=> ctrl slot=0 create type=ld drives=1I:1:3,1I:1:4,2I:1:6,2I:1:7,2I:1:8 raid=5

The above command creates a logical drive with the five physical drives on RAID 5 configuration in slot 0.

Once these logical drives are created, you should see the disks from the fdisk and you can format it from there and start using it.

After you create a logical drive, execute the following command to verify that the LD got created. In this example, it shows that the RAID 5 logical drive got created successfully.

=> ctrl slot=0 ld all show status

   logicaldrive 1 (136.7 GB, RAID 1): OK
   logicaldrive 2 (1.1 TB, RAID 5): OK

10. Rescan for New Devices

If you’ve added new physical hard disk, they won’t automatically show-up immediately. You have to scan for new devices as shown below.

=> rescan

11. View Detailed Logical Drive Status

To display the detailed status of the logical drive, do the following:

=> ctrl slot=0 ld 2 show

Smart Array P410i in Slot 0 (Embedded)

   array B

      Logical Drive: 2
         Size: 1.1 TB
         Fault Tolerance: RAID 5
         Heads: 255
         Sectors Per Track: 32
         Cylinders: 65535
         Strip Size: 256 KB
         Full Stripe Size: 1024 KB
         Status: OK
         Caching:  Enabled
         Parity Initialization Status: In Progress
         Unique Identifier: 600508B1001031303144363143301000
         Disk Name: /dev/cciss/c0d1
         Mount Points: None
         Logical Drive Label: A4967E2950014380101D61C008BE
         Drive Type: Data

The above shows the RAID type, the disk name assigned to the logical drive, and other information about the logical drive number 2.

12. Delete Logical Drive

To delete a logical drive with the number 2 use the below command.

=> ctrl slot=0 ld 2 delete

Warning: Deleting an array can cause other array letters to become renamed.
         E.g. Deleting array A from arrays A,B,C will result in two remaining
         arrays A,B ... not B,C

Warning: Deleting the specified device(s) will result in data being lost.
         Continue? (y/n) y

13. Add New Physical Drive to Logical Volume

To add the new drives to existing logical volume, do the following.

=> ctrl slot=0 ld 2 add drives=2I:1:6,2I:1:7

In this example, we are adding two additional drives specified above to the logical volume number 2.

14. Add Spare Disks

To add the spare disks to arrays that can be used in case of disk failures on one of the logical drives, do the following:

=> ctrl slot=0 array all add spares=2I:1:6,2I:1:7

In this example, we are adding two spare disks to the array.

15. Enable or Disable Cache

The below commands enable or disable cache for the entire slot.

=> ctrl slot=0 modify dwc=disable

=> ctrl slot=0 modify dwc=enable

16. Erase Physical Drive

Execute the following command to erase a physical drive in array B on slot 0.

=> ctrl slot=0 pd 2I:1:6 modify erase

17. Blink Physical Disk LED

To blink the LED on the physical drives for the logical drive 2, do the following. This will make the LEDs blink on all the physical drives that belongs to logical drive 2.

=> ctrl slot=0 ld 2 modify led=on

Once you know which drive belongs to logical drive 2, turn the LED blinking off as shown below.

=> ctrl slot=0 ld 2 modify led=off
Add your comment

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

Comments on this entry are closed.

  • Dariusz July 23, 2014, 2:51 am

    nice article. Is it possible to extend existing hardware RAID ?

  • ashish January 27, 2015, 7:24 am

    @dariusz

    hpacucli> ctrl slot=0 ld 4 add drives=2:3
    ## Expanding ld by adding one more drive

    hpacucli> ctrl slot=0 ld 4 modify size=500 forced
    ## Extending the LogicalDrives

    hpacucli> ctrl slot=0 array all add spares=1:5,1:7
    ## Add two Spare disks

  • Bala August 14, 2015, 10:57 am

    You save my life. This helped me to effortlessly create a new logicaldrive and add disks in my home server.

    When I tried to add a new drive to an existing logicaldrive 1, it failed throwing the below msg.

    root@ubuntu:~# hpacucli ctrl slot=0 ld 1 add drives=1I:1:3,1I:1:4
    Error: This operation is not supported with the current configuration. Use the
    “show” command on devices to show additional details about the
    configuration.
    Reason: Transformation size zero

    Does it mean my setup doesnt allow or I can’t add disks to an existing logical disks?

  • A El Gatit August 18, 2015, 3:58 pm

    Thanks for the article!!

    Do you know how I can set it up so that if one of the drives fails, I get sent an email?

  • Mike Schwager October 16, 2015, 8:46 am

    Which Linux disk device is associated with which HP logical drive?

    hpssacli ctrl slot=0 logicaldrive all show detail

    Very handy when you are removing disks and you don’t want to pull the wrong ones. 🙂

  • Sai November 14, 2015, 8:27 am

    Hi Ashish,
    Thanks in advance

    i want to know, you mentioned 500 in below command, so you mean that value is 500gb. i have 300Gb and want to extend 200Gb. so which command we can use to extend the disk.

    ctrl slot=0 ld 4 modify size=500 forced

  • Randy March 25, 2016, 9:27 am

    awesome article!

  • Wouter May 23, 2016, 2:51 am

    Thanks a lot for making the article.

    Saved me a lot of time figuring out the commands myself.

  • pupu August 13, 2016, 12:32 pm

    It is even possible to convert single-drive RAID0 to RAID1 by this command.

    hpacucli ctrl slot=0 show config
    hpacucli ctrl slot=0 modify rebuildpriority=high
    hpacucli ctrl slot=0 ld 1 add drives=allunassigned
    hpacucli ctrl slot=0 ld 1 modify raid=1

  • Suresh January 8, 2017, 5:37 am

    Hi,

    Already server is running with Raid1. We want to break the Raid and should run with Single disk temporarily. How can we break the raid and again how to attach.

    Thanks!!.

  • Joon April 10, 2017, 6:52 pm

    After adding a new disk on an existing RAID 5 array, what is the linux command to extend the root “/” folder that is on a LVM VG group?

    Thanks!

  • Mario April 27, 2017, 6:07 am

    Here is script for my p400i controller for mail report if drive fails.
    U can use it with cron.

    #!/bin/bash
    ###
    #If something went wrong with the HP smartarray disks this script will send an error email
    ###
    MAIL=mymail@domain.net
    HPACUCLI_TMP=/tmp/hpacucli.log
    
    if hpacucli controller slot=1 physicaldrive all show | grep 'Failed'
    then
    msg="RAID Controller Errors"
    echo $msg
    #$msg2=hpacucli controller slot=1 physicaldrive all show
    #echo $msg2
    logger -p syslog.error -t RAID "$msg"
    hpacucli controller slot=1 pd all show > $HPACUCLI_TMP
    mail -s "$HOSTNAME [ERROR] - $msg" "$MAIL" < $HPACUCLI_TMP
    rm -f $HPACUCLI_TMP
    else
    echo "Everything Good"
    fi