换盘流程:https://blog.51cto.com/wendashuai/2501063

linux系统下更换磁盘,但是对于惠普的阵列卡,使用常见的MegaCli 、storcli、percli都无法获取到磁盘信息,这时需要使用专用的工具ssacli。
rpm包下载地址:https://downloads.linux.hpe.com/SDR/repo/mcp/centos/7/x86_64/current/

查看raid卡信息(包括控制器状态、Cache状态、电池状态)

# ssacli ctrl all show status

查看raid详细信息

# ssacli ctrl slot=0 show config detail

查看raid状态

# ssacli ctrl slot=0 ld all show

查看slot 0 阵列A 所有逻辑驱动器信息

# ssacli ctrl slot=0 array A ld all show

查看slot 0 阵列A 所有物理驱动器信息

# ssacli ctrl slot=0 array A pd all show

查看硬盘

# ssacli ctrl slot=0 pd all show status  //查看物理硬盘状态
# ssacli ctrl slot=0 pd all show  //查看物理硬盘

创建raid10

# ssacli ctrl slot=0 create type=ld drives=1I:1:3,1I:1:4,2I:1:5,2I:1:6 raid=1+0

用3,4,5号盘创建一个raid5阵列

# ssacli ctrl slot=0 create type=ld drives=1I:1:3,1I:1:4,2I:1:5 raid=5

创建raid1

# ssacli ctrl slot=1 create type=ld drives=1I:1:1-1I:1:2 raid=1

删除raid

# ssacli ctrl slot=1 array B delete forced

缓存:

查看cache信息:

# ssacli ctrl all show config detail | grep -i cache

关闭物理磁盘cache

# ssacli ctrl slot=0 modify drivewritecache=disable

打开逻辑磁盘缓存

# ssacli ctrl slot=0 logicaldrive 2 modify caching=enable

在没有电池的情况下开启raid写缓存

# ssacli ctrl slot=0 modify nobatterywritecache=enable

设置读写百分比

# ssacli ctrl slot=0 modify cacheratio=10/90

指示灯:

打开array B磁盘的led灯

# ssacli ctrl slot=0 array B modify led=on

打开3号磁盘的led灯

# ssacli ctrl slot=0 pd 1I:1:3 modify led=on

实战演习:

节点磁盘信息lsblk:

NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda            8:0    0 279.4G  0 disk 
├─sda1         8:1    0    24M  0 part 
├─sda2         8:2    0   200M  0 part 
├─sda3         8:3    0   250M  0 part /boot
└─sda4         8:4    0 278.8G  0 part 
  ├─os-root  253:0    0 274.7G  0 lvm  /
  └─os-swap  253:1    0     4G  0 lvm  [SWAP]
sdb            8:16   0   1.7T  0 disk 
└─sdb1         8:17   0   1.7T  0 part /var/lib/ceph/osd/ceph-4
sdc            8:32   0   1.7T  0 disk 
└─sdc1         8:33   0   1.7T  0 part /var/lib/ceph/osd/ceph-80
sdd            8:48   0   1.7T  0 disk 
└─sdd1         8:49   0   1.7T  0 part /var/lib/ceph/osd/ceph-67
sde            8:64   0   1.7T  0 disk 
└─sde1         8:65   0   1.7T  0 part /var/lib/ceph/osd/ceph-9
sdf            8:80   0   1.7T  0 disk 
└─sdf1         8:81   0   1.7T  0 part /var/lib/ceph/osd/ceph-22
sdg            8:96   0   1.7T  0 disk 
└─sdg1         8:97   0   1.7T  0 part /var/lib/ceph/osd/ceph-30
sdh            8:112  0   1.7T  0 disk 
└─sdh1         8:113  0   1.7T  0 part /var/lib/ceph/osd/ceph-47
sdi            8:128  0   1.7T  0 disk 
└─sdi1         8:129  0   1.7T  0 part /var/lib/ceph/osd/ceph-24
sdj            8:144  0   1.7T  0 disk 
└─sdj1         8:145  0   1.7T  0 part /var/lib/ceph/osd/ceph-56
sdk            8:160  0   1.7T  0 disk 
└─sdk1         8:161  0   1.7T  0 part /var/lib/ceph/osd/ceph-39
sdl            8:176  0   1.7T  0 disk 
└─sdl1         8:177  0   1.7T  0 part /var/lib/ceph/osd/ceph-86
sdm            8:192  0   1.7T  0 disk 
└─sdm1         8:193  0   1.7T  0 part /var/lib/ceph/osd/ceph-72
nvme0n1      259:0    0   1.5T  0 disk 
├─nvme0n1p1  259:1    0    20G  0 part 
├─nvme0n1p2  259:2    0    20G  0 part 
├─nvme0n1p3  259:3    0    20G  0 part 
├─nvme0n1p4  259:4    0    20G  0 part 
├─nvme0n1p5  259:5    0    20G  0 part 
├─nvme0n1p6  259:6    0    20G  0 part 
├─nvme0n1p7  259:7    0    20G  0 part 
├─nvme0n1p8  259:8    0    20G  0 part 
├─nvme0n1p9  259:9    0    20G  0 part 
├─nvme0n1p10 259:10   0    20G  0 part 
├─nvme0n1p11 259:11   0    20G  0 part 
└─nvme0n1p12 259:12   0    20G  0 part 

查看slot 0 阵列A 所有逻辑驱动器信息

[root@node-9 ~]#  ssacli ctrl slot=0 array A ld all show

Smart Array P840ar in Slot 0 (Embedded)

   Array A

      logicaldrive 1 (279.37 GB, RAID 1, OK)

[root@node-9 ~]# 

[root@node-9 ~]#  ssacli ctrl slot=0 array M ld all show

Smart Array P840ar in Slot 0 (Embedded)

   Array M

      logicaldrive 13 (1.64 TB, RAID 0, OK)

查看slot 0 阵列A 所有物理信息

[root@node-9 ~]#  ssacli ctrl slot=0 array M pd all show

Smart Array P840ar in Slot 0 (Embedded)

   Array M

      physicaldrive 2I:2:6 (port 2I:box 2:bay 6, SAS HDD, 1.8 TB, OK)

查看所有物理硬盘信息:

[root@node-9 ~]# ssacli ctrl slot=0 pd all show status

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

查看所有逻辑硬盘信息:

[root@node-9 ~]#  ssacli ctrl slot=0 ld all show

Smart Array P840ar in Slot 0 (Embedded)

   Array A

      logicaldrive 1 (279.37 GB, RAID 1, OK)

   Array B

      logicaldrive 2 (1.64 TB, RAID 0, OK)

   Array C

      logicaldrive 3 (1.64 TB, RAID 0, OK)

   Array D

      logicaldrive 4 (1.64 TB, RAID 0, OK)

   Array E

      logicaldrive 5 (1.64 TB, RAID 0, OK)

   Array F

      logicaldrive 6 (1.64 TB, RAID 0, OK)

   Array G

      logicaldrive 7 (1.64 TB, RAID 0, OK)

   Array H

      logicaldrive 8 (1.64 TB, RAID 0, OK)

   Array I

      logicaldrive 9 (1.64 TB, RAID 0, OK)

   Array J

      logicaldrive 10 (1.64 TB, RAID 0, OK)

   Array K

      logicaldrive 11 (1.64 TB, RAID 0, OK)

   Array L

      logicaldrive 12 (1.64 TB, RAID 0, OK)

   Array M

      logicaldrive 13 (1.64 TB, RAID 0, OK)

[root@node-9 ~]# 

查看所有物理硬盘信息+Array 逻辑信息:

[root@node-9 ~]# ssacli ctrl slot=0 pd all show 

Smart Array P840ar in Slot 0 (Embedded)

   Array A

      physicaldrive 1I:3:1 (port 1I:box 3:bay 1, SAS HDD, 300 GB, OK)
      physicaldrive 1I:3:2 (port 1I:box 3:bay 2, SAS HDD, 300 GB, OK)

   Array B

      physicaldrive 1I:3:3 (port 1I:box 3:bay 3, SAS HDD, 1.8 TB, OK)

   Array C

      physicaldrive 1I:3:4 (port 1I:box 3:bay 4, SAS HDD, 1.8 TB, OK)

   Array D

      physicaldrive 1I:3:5 (port 1I:box 3:bay 5, SAS HDD, 1.8 TB, OK)

   Array E

      physicaldrive 1I:3:6 (port 1I:box 3:bay 6, SAS HDD, 1.8 TB, OK)

   Array F

      physicaldrive 1I:3:7 (port 1I:box 3:bay 7, SAS HDD, 1.8 TB, OK)

   Array G

      physicaldrive 1I:3:8 (port 1I:box 3:bay 8, SAS HDD, 1.8 TB, OK)

   Array H

      physicaldrive 2I:2:1 (port 2I:box 2:bay 1, SAS HDD, 1.8 TB, OK)

   Array I

      physicaldrive 2I:2:2 (port 2I:box 2:bay 2, SAS HDD, 1.8 TB, OK)

   Array J

      physicaldrive 2I:2:3 (port 2I:box 2:bay 3, SAS HDD, 1.8 TB, OK)

   Array K

      physicaldrive 2I:2:4 (port 2I:box 2:bay 4, SAS HDD, 1.8 TB, OK)

   Array L

      physicaldrive 2I:2:5 (port 2I:box 2:bay 5, SAS HDD, 1.8 TB, OK)

   Array M

      physicaldrive 2I:2:6 (port 2I:box 2:bay 6, SAS HDD, 1.8 TB, OK)

[root@node-9 ~]# 

定位物理磁盘、逻辑磁盘、盘符关系:
可以结合点灯精准判断磁盘位置。

[root@node-9 ~]# ssacli ctrl slot=0 show config detail | grep -E "Array|Disk Name|physicaldrive|Size" | grep -vE "Strip|Logical"
Smart Array P840ar in Slot 0 (Embedded)
   Total Cache Size: 2.0
      physicaldrive 1I:3:5 (port 1I:box 3:bay 5, SAS HDD, 1.8 TB, OK)
      physicaldrive 1I:3:6 (port 1I:box 3:bay 6, SAS HDD, 1.8 TB, OK)
      physicaldrive 1I:3:7 (port 1I:box 3:bay 7, SAS HDD, 1.8 TB, OK)
      physicaldrive 1I:3:8 (port 1I:box 3:bay 8, SAS HDD, 1.8 TB, OK)
      physicaldrive 1I:3:4 (port 1I:box 3:bay 4, SAS HDD, 1.8 TB, OK)
      physicaldrive 1I:3:3 (port 1I:box 3:bay 3, SAS HDD, 1.8 TB, OK)
      physicaldrive 1I:3:2 (port 1I:box 3:bay 2, SAS HDD, 300 GB, OK)
      physicaldrive 1I:3:1 (port 1I:box 3:bay 1, SAS HDD, 300 GB, OK)
      physicaldrive 2I:2:5 (port 2I:box 2:bay 5, SAS HDD, 1.8 TB, OK)
      physicaldrive 2I:2:6 (port 2I:box 2:bay 6, SAS HDD, 1.8 TB, OK)
      physicaldrive 2I:2:4 (port 2I:box 2:bay 4, SAS HDD, 1.8 TB, OK)
      physicaldrive 2I:2:3 (port 2I:box 2:bay 3, SAS HDD, 1.8 TB, OK)
      physicaldrive 2I:2:2 (port 2I:box 2:bay 2, SAS HDD, 1.8 TB, OK)
      physicaldrive 2I:2:1 (port 2I:box 2:bay 1, SAS HDD, 1.8 TB, OK)
   Array: A
      Array Type: Data 
         Size: 279.37 GB
         Disk Name: /dev/sda 
            physicaldrive 1I:3:2 (port 1I:box 3:bay 2, SAS HDD, 300 GB, OK)
            physicaldrive 1I:3:1 (port 1I:box 3:bay 1, SAS HDD, 300 GB, OK)
      physicaldrive 1I:3:1
         Size: 300 GB
      physicaldrive 1I:3:2
         Size: 300 GB
   Array: B
      Array Type: Data 
         Size: 1.64 TB
         Disk Name: /dev/sdb 
      physicaldrive 1I:3:3
         Size: 1.8 TB
   Array: C
      Array Type: Data 
         Size: 1.64 TB
         Disk Name: /dev/sdc 
      physicaldrive 1I:3:4
         Size: 1.8 TB
   Array: D
      Array Type: Data 
         Size: 1.64 TB
         Disk Name: /dev/sdd 
      physicaldrive 1I:3:5
         Size: 1.8 TB
   Array: E
      Array Type: Data 
         Size: 1.64 TB
         Disk Name: /dev/sde 
      physicaldrive 1I:3:6
         Size: 1.8 TB
   Array: F
      Array Type: Data 
         Size: 1.64 TB
         Disk Name: /dev/sdf 
      physicaldrive 1I:3:7
         Size: 1.8 TB
   Array: G
      Array Type: Data 
         Size: 1.64 TB
         Disk Name: /dev/sdg 
      physicaldrive 1I:3:8
         Size: 1.8 TB
   Array: H
      Array Type: Data 
         Size: 1.64 TB
         Disk Name: /dev/sdh 
      physicaldrive 2I:2:1
         Size: 1.8 TB
   Array: I
      Array Type: Data 
         Size: 1.64 TB
         Disk Name: /dev/sdi 
      physicaldrive 2I:2:2
         Size: 1.8 TB
   Array: J
      Array Type: Data 
         Size: 1.64 TB
         Disk Name: /dev/sdj 
      physicaldrive 2I:2:3
         Size: 1.8 TB
   Array: K
      Array Type: Data 
         Size: 1.64 TB
         Disk Name: /dev/sdk 
      physicaldrive 2I:2:4
         Size: 1.8 TB
   Array: L
      Array Type: Data 
         Size: 1.64 TB
         Disk Name: /dev/sdl 
      physicaldrive 2I:2:5
         Size: 1.8 TB
   Array: M
      Array Type: Data 
         Size: 1.64 TB
         Disk Name: /dev/sdm 
      physicaldrive 2I:2:6
         Size: 1.8 TB
[root@node-9 ~]#