HPssacli工具安装使用
HP官网支持
https://support.hpe.com/hpesc/public/home
HP 服务器管理组件yum源
适用于CentOS 的Management Component Pack(i386 和x86_64)
| Bash |
|---|
| cat <<eof > /etc/yum.repos.d/mcp.repo
[mcp]
name=Management Component Pack
baseurl=http://downloads.linux.hpe.com/SDR/repo/mcp/CentOS/\$releasever/\$basearch/10.40
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/GPG-KEY-mcp
eof
yum clean all
最后的10.40版本可以实际浏览页面查看
|
管理组件源安装包
| Bash |
|---|
| hp-health:健康应用程序和命令行实用程序,可以监视风扇、电源、温度传感器和其他管理事件
hponcfg:iLO在线配置实用程序
hp-snmp-agents:基于SNMP协议的代理和工具的集合,它支持通过SNMP监视风扇、电源、温度传感器和其他管理事件
hpsmh:管理主页(hpsmh)为单个服务器管理提供了一个统一的视图,突出了紧密集成的管理功能,包括性能、故障、安全性、诊断、配置和软件更改管理
hp-smh-templates:系统管理主页模板(HP -smh- Templates)包含用于服务器、管理处理器、NIC和存储子系统的系统管理主页模板。模板是html、javascript和php文件的集合,这些文件充当GUI来显示每个子系统代理提供的SNMP数据。这个包依赖于hp-snmp-agents包,也依赖于hpsmh包来为浏览器提供页面
hpssacli:阵列配置实用程序CLI (hpssacli)是一个基于命令行的磁盘配置程序,允许配置智能阵列控制器和RAID阵列控制器
hp-ams:HP无代理管理服务(HP-ams)为HP集成熄灯4 (HP iLO 4)嵌入式健康和报警提供支持
|
安装包
yum 直接安装
下载到本地安装
| Bash |
|---|
| yum install --downloadonly --downloaddir=/opt/ hpssacli
或者
yum install yum-utils
yumdownloader --resolve --destdir=/opt/ hpssacli
|
建议使用第二种,--resolve 会下载依赖包
安装本地包
| Bash |
|---|
| yum localinstall /opt/hpssacli-2.40-13.0.x86_64.rpm
|
语法介绍
hpssacli工具详细命令可以参考https://support.hpe.com/hpsc/doc/public/display?docId=emr_na-c03909334&docLocale=en_US
命令行由三个部分组成:一个目标设备,一个命令,如果需要,还有一个带值的参数。使用尖括号表示一个必需的变量,用普通括号表示一个可选的变量
令行结构如下:
| Bash |
|---|
| <target> <command> [parameter=value]
<target> 的格式:
[controller all|slot=#|serialnumber=#]
[array all|<id>]
[physicaldrive all|allunassigned|[#:]#:#|[#:]#:#-[#:]#:#]
[ssdphysicaldrive all|allunassigned|[#:]#:#|[#:]#:#-[#:]#:#]
[logicaldrive all|#]
[enclosure all|#:#|serialnumber=#]
[licensekey all|<key>]
[ssdinfo]
Note 1: The #:#:# syntax is only needed for systems that
specify port:box:bay. Other physical drive targeting
schemes are box:bay and port:id.
Example targets:
controller slot=5
controller serialnumber=P21DA2322S
controller slot=7 array A
controller slot=5 logicaldrive 5
controller slot=5 physicaldrive 1:5
controller slot=5 physicaldrive 1E:2:3
controller slot=5 ssdphysicaldrive all
controller slot=5 enclosure 4E:1 show
controller slot=5 licensekey XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
For detailed command information type any of the following:
help add
help create
help delete
help diag
help modify
help remove
help shorthand
help show
help target
help rescan
help version
|
常用查看命令
我们配置raid一般在GUI配置,在系统大多都是使用查询,整理了常用的几个命令
查看所有控制器状态
| Bash |
|---|
| root@pts/0 # hpssacli ctrl all show
Smart Array P420i in Slot 0 (Embedded) (sn: 001438027B06B80)
Smart Array P431 in Slot 2 (sn: PCZED0ARH7T0DZ)
|
在192.168.2.145上,可以看到有两个raid卡,第二个raid卡挂载了HPD6000的盘柜
查看slot 0阵列信息详细状态
| Bash |
|---|
| root@pts/0 # hpssacli ctrl slot=0 show config detail
Smart Array P420i in Slot 0 (Embedded)
Note: Predictive Spare Activation Mode is enabled, physical drives that are in predictive failure state will not be available for use as data or spare drives.
Bus Interface: PCI
Slot: 0
Serial Number: 5001438022791070
Cache Serial Number: PBKUC0BRH4U2IZ
Controller Status: OK
Hardware Revision: B
Firmware Version: 3.22
Rebuild Priority: Medium
Expand Priority: Medium
Surface Scan Delay: 15 secs
Surface Scan Mode: Idle
Parallel Surface Scan Supported: No
Queue Depth: Automatic
Monitor and Performance Delay: 60 min
Elevator Sort: Enabled
Degraded Performance Optimization: Disabled
Inconsistency Repair Policy: Disabled
Wait for Cache Room: Disabled
Surface Analysis Inconsistency Notification: Disabled
Post Prompt Timeout: 0 secs
Cache Board Present: True
Cache Status: OK
......
|
可以查看物理磁盘和逻辑磁盘的对应关系 slot=0 也可以替换成all,查看所有阵列信息,或者查看slot=2 第二阵列信息
查看逻辑磁盘信息
| Bash |
|---|
| root@pts/0 # hpssacli ctrl slot=0 logicaldrive 1 show
Smart Array P420i in Slot 0 (Embedded)
array A
Logical Drive: 1
Size: 2.2 TB
Fault Tolerance: 1+0
Heads: 255
Sectors Per Track: 63
Cylinders: 65535
Strip Size: 256 KB
Full Stripe Size: 1024 KB
Status: OK
Caching: Enabled
Unique Identifier: 600508B1001CB19E7539CA0B1B65EC64
Disk Name: /dev/sda
Mount Points: /boot 200 MB Partition Number 3, / 2.2 TB Partition Number 4
OS Status: LOCKED
Logical Drive Label: A03294095001438022791070 ED49
Mirror Group 1:
physicaldrive 1I:2:1 (port 1I:box 2:bay 1, SAS, 600 GB, OK)
physicaldrive 1I:2:2 (port 1I:box 2:bay 2, SAS, 600 GB, OK)
physicaldrive 2I:2:5 (port 2I:box 2:bay 5, SAS, 600 GB, OK)
physicaldrive 2I:2:6 (port 2I:box 2:bay 6, SAS, 600 GB, OK)
Mirror Group 2:
physicaldrive 1I:2:3 (port 1I:box 2:bay 3, SAS, 600 GB, OK)
physicaldrive 1I:2:4 (port 1I:box 2:bay 4, SAS, 600 GB, OK)
physicaldrive 2I:2:7 (port 2I:box 2:bay 7, SAS, 600 GB, OK)
physicaldrive 2I:2:8 (port 2I:box 2:bay 8, SAS, 600 GB, OK)
Drive Type: Data
LD Acceleration Method: Controller Cache
|
此处 1 为 阵列卡做的第一个raid,上述信息可以看到做的raid 1+0,一共8块物理盘
查看物理磁盘信息
| Bash |
|---|
| root@pts/0 # hpssacli ctrl slot=0 physicaldrive 1I:2:1 show
Smart Array P420i in Slot 0 (Embedded)
array A
physicaldrive 1I:2:1
Port: 1I
Box: 2
Bay: 1
Status: OK
Drive Type: Data Drive
Interface Type: SAS
Size: 600 GB
Drive exposed to OS: False
Native Block Size: 512
Rotational Speed: 10500
Firmware Revision: HPD2
Serial Number: S0M0JCAG0000B351C1LJ
Model: HP EG0600FCVBK
Current Temperature (C): 27
Maximum Temperature (C): 45
PHY Count: 2
PHY Transfer Rate: 6.0Gbps, Unknown
Drive Authentication Status: OK
Carrier Application Version: 11
Carrier Bootloader Version: 6
Sanitize Erase Supported: True
Unrestricted Sanitize Supported: False
|
1I:2:1 是指定的查看某一物理磁盘的详细信息
查看slot 0所有阵列信息
| Bash |
|---|
| root@pts/0 # hpssacli ctrl slot=0 array all show
Smart Array P420i in Slot 0 (Embedded)
array A (SAS, Unused Space: 0 MB)
array B (SAS, Unused Space: 0 MB)
|
可以看到这台服务器做了两个raid组 A|B
查看slot 0 阵列的所有逻辑驱动器信息
| Bash |
|---|
| root@pts/0 # hpssacli ctrl slot=0 ld all show
Smart Array P420i in Slot 0 (Embedded)
array A
logicaldrive 1 (558.9 GB, RAID 1, OK)
array B
logicaldrive 2 (1.6 TB, RAID 1+0, OK)
|
可以看到raid A 做的raid1,raid B做的raid10
查看slot 0 阵列A 所有物理驱动器状态
| Bash |
|---|
| root@pts/0 # hpssacli ctrl slot=0 array A pd all show status
physicaldrive 1I:2:1 (port 1I:box 2:bay 1, 600 GB): OK
physicaldrive 1I:2:2 (port 1I:box 2:bay 2, 600 GB): OK
physicaldrive 1I:2:3 (port 1I:box 2:bay 3, 600 GB): OK
physicaldrive 1I:2:4 (port 1I:box 2:bay 4, 600 GB): OK
physicaldrive 2I:2:5 (port 2I:box 2:bay 5, 600 GB): OK
physicaldrive 2I:2:6 (port 2I:box 2:bay 6, 600 GB): OK
physicaldrive 2I:2:7 (port 2I:box 2:bay 7, 600 GB): OK
physicaldrive 2I:2:8 (port 2I:box 2:bay 8, 600 GB): OK
|
查看所有阵列卡、缓存、电池状态
| Bash |
|---|
| root@pts/0 # hpssacli ctrl all show status
Smart Array P420i in Slot 0 (Embedded)
Controller Status: OK
Cache Status: OK
Battery/Capacitor Status: OK
Smart Array P431 in Slot 2
Controller Status: OK
Cache Status: OK
Battery/Capacitor Status: OK
|
查看raid状态
| Bash |
|---|
| root@pts/0 # hpssacli ctrl slot=0 array all show status
array A: OK
array B: OK
root@pts/0 # hpssacli ctrl slot=0 ld all show status
logicaldrive 1 (558.9 GB, 1): OK
logicaldrive 2 (1.6 TB, 1+0): OK
|
一个是组状态,一个是raid状态
常用操作命令
创建
用3,4,5,6号盘创建一个raid1+0阵列
| Bash |
|---|
| hpssacli ctrl slot=0 create type=ld drives=1I:2:3,1I:2:4,2I:2:5,2I:2:6 raid=1+0
|
用3,4,5号盘创建一个raid5阵列
| Bash |
|---|
| hpssacli ctrl slot=0 create type=ld drives=1I:2:3,1I:2:4,2I:2:5 raid=5
|
用3号盘创建一个raid0阵列
| Bash |
|---|
| hpssacli ctrl slot=0 create type=ld drives=1I:2:3 raid=0
|
删除
强制删除阵列 A
| Bash |
|---|
| hpssacli ctrl slot=0 array A delete forced
|
强制删除逻辑磁盘2
| Bash |
|---|
| hpssacli ctrl slot=0 logicaldrive 2 delete forced
|
缓存
关闭物理磁盘cache
| Bash |
|---|
| hpssacli ctrl slot=0 modify drivewritecache=disable
查看
hpssacli ctrl all show config detail|grep Drive Write Cache
Drive Write Cache: Disabled
|
打开逻辑磁盘缓存
| Bash |
|---|
| hpssacli ctrl slot=0 logicaldrive 2 modify caching=enable
|
在没有电池的情况下开启raid写缓存
| Bash |
|---|
| hpssacli ctrl slot=0 modify nobatterywritecache=enable
|
设置读写百分比
| Bash |
|---|
| hpssacli ctrl slot=0 modify cacheratio=10/90
|
关闭SSD Smart Path功能
| Bash |
|---|
| hpssacli ctrl slot=0 array A modify ssdsmartpath=disable
|
默认缓存是开启的 ,而且SSD Smart Path默认也是关闭的,因为打开逻辑缓存需要关闭SSD Smart Path功能
如果是SSD做的raid ,SSD Smart Path功能是开启的,开启缓存会报错Error: Invalid drive specified: ,这时需要关闭SSD Smart Path功能
指示灯
打开array B磁盘的led灯
| Bash |
|---|
| hpssacli ctrl slot=0 array B modify led=on
|
打开3号磁盘的led灯
| Bash |
|---|
| hpssacli ctrl slot=0 pd 1I:1:3 modify led=on
|