2

参考文章:https://support.huawei.com/enterprise/zh/doc/EDOC1000041337/75f2d44b

  如何通过硬盘盘符查询硬盘槽位,这个要分两种情况:
   • 硬盘以直通方式使用时
   • 硬盘以RAID组方式使用时

  在此之前,我们需要准备 smartctl 和 storcli 工具。smartctl 可以直接 yum 下载(smartmontools),storcli 需要去官方网站下载安装,官方网站:https://www.broadcom.com/

1、直通状态

此时 sdf 为直通状态。假如我要点亮sdf,先要根据盘符通过使用 smartctl 工具确认硬盘序列号。

[root@controller ~]# smartctl -a /dev/sdf | grep -i 'Serial number'
Serial number:        WFJ3ZNF2

然后通过硬盘序列号确认硬盘槽位号。

[root@controller ~]# storcli /call/eall/sall show  all | grep -B 2 'SN = WFJ3ZNF2'
Drive /c0/e14/s8 Device attributes :
==================================
SN = WFJ3ZNF2

使用 start locate 命令点亮硬盘定位指示灯。

[root@controller ~]# storcli /c0/e14/s8 start locate
CLI Version = 007.1804.0000.0000 Apr 09, 2021
Operating system = Linux 3.10.0-957.el7.x86_64
Controller = 0
Status = Success
Description = Start Drive Locate Succeeded.

# 关闭指示灯
[root@controller ~]# storcli /c0/e14/s8 stop locate

2、Raid 状态

  此时 sda 为 Raid 1 状态。我要点亮sda,先要通过块设备信息确认硬盘盘符对应的 target ID。
  执行以下命令查询 sdf 对应的的 target ID。其中打印信息中 targetx:y:z 中的 z 即为 target ID。如下所示,“target ID”为0。

[root@controller ~]# lsscsi | grep sda
[0:2:5:0]    disk    LSI      MR9240-8i        2.13  /dev/sdf

[root@controller ~]# ll /sys/block/ | grep sda
lrwxrwxrwx. 1 root root 0 Jul  7 15:24 sda -> ../devices/pci0000:80/0000:80:01.0/0000:81:00.0/host0/target0:2:0/0:2:0:0/block/sda

  通过 target ID 确认硬盘槽位号,执行以下命令查询所有硬盘信息,并将查询到的信息保存为文件。然后在文件中查找 “Target ID” 字段,在查找到的 “Target ID” 为 0 所在的硬盘信息中记录 “Device IDs” 对应的信息。

[root@controller ~]# storcli /call show alilog > sda.txt
[root@controller ~]# vim sda.txt
......
Detail Logical Drive Information
--------------------------------

Target ID                      : 0
......
Total size of the logical drive: 571808MB
Logical Drive owner's Device ID: 255
Number of Physical Devices  : 2
Device IDs:     25
Device IDs:     26
......

[root@controller ~]# storcli /call/eall/sall show | sed '/---/,/^$/!d'      # DID 就是 Device IDs
---------------------------------------------------------------------------------
EID:Slt DID State DG       Size Intf Med SED PI SeSz Model               Sp Type 
---------------------------------------------------------------------------------  
14:1     25 Onln   0 558.406 GB SAS  HDD N   N  512B ST600MM0069         U  -    
14:2     26 Onln   0 558.406 GB SAS  HDD N   N  512B ST600MM0069         U  -    
---------------------------------------------------------------------------------

此时确认硬盘槽位号,依次点亮即可:

[root@controller ~]#  storcli /c0/e14/s1 start locate
[root@controller ~]#  storcli /c0/e14/s2 start locate
2

发表评论

验证码: 52 − 48 =