使用sas3ircu或storcli64查看服务器硬盘槽位及接口类型等信息

因需要替换服务器故障盘,所以需要确定故障盘所在槽位

本文介绍两种方法:

  • 使用sas3ircu命令查看硬盘槽位(验证曙光服务器查槽位可用)
  • 使用storcli64命令查看硬盘槽位(验证华为服务器查槽位可用)

简要介绍两种方式的命令

sas3ircu:
./sas3ircu 0 display(0代表第几个RAID控制器)

storcli64:
./storcli64 /c0 show all(0代表第几个RAID控制器)

一、使用sas3ircu命令查看硬盘槽位

文件上传在我的资源里了(免费下载):https://download.csdn.net/download/weixin_43860781/13089947

将文件放置在系统中并解压该文件

$ mkdir /home/test && cd /home/test
$ unzip SAS3IRCU_P12.zip
$ cd SAS3IRCU_P12

根据不同的系统,选择不同的目录进入

$ ls
IRCU_MPT_GEN3_Phase12.0-13.00.00.00.pdf  sas3ircu_freebsd_i386_rel  sas3ircu_solaris_sparc_rel  sas3ircu_vmware_esx55_rel
README_SAS3IRCU_P12.txt                  sas3ircu_linux_ppc64_rel   sas3ircu_solaris_x86_rel    sas3ircu_win_x64_rel
sas3ircu_dos_rel                         sas3ircu_linux_x64_rel     sas3ircu_udk_uefi_x64_rel   sas3ircu_win_x86_rel
sas3ircu_freebsd_amd64_rel               sas3ircu_linux_x86_rel     sas3ircu_vmware_esx50_rel

现在基本上都是64位的系统,不确定的话可以用uname -a查看

进入对应的目录中,赋予权限

$ cd sas3ircu_linux_x64_rel/
$ chmod +x sas3ircu

查询RAID-Controller(raid控制器)

node5:~/test/SAS3IRCU_P12/sas3ircu_linux_x64_rel # ./sas3ircu list
Avago Technologies SAS3 IR Configuration Utility.
Version 13.00.00.00 (2016.03.08) 
Copyright (c) 2009-2016 Avago Technologies. All rights reserved. 


         Adapter      Vendor  Device                       SubSys  SubSys 
 Index    Type          ID      ID    Pci Address          Ven ID  Dev ID 
 -----  ------------  ------  ------  -----------------    ------  ------ 
   0     SAS3008       1000h   97h    00h:1bh:00h:00h      1000h   0097h 

         Adapter      Vendor  Device                       SubSys  SubSys 
 Index    Type          ID      ID    Pci Address          Ven ID  Dev ID 
 -----  ------------  ------  ------  -----------------    ------  ------ 
   1     SAS3008       1000h   97h    00h:3bh:00h:00h      1000h   0097h 
SAS3IRCU: Utility Completed Successfully.

查看磁盘阵列内硬盘信息

命令格式:sas3ircu {RAID控制器号} display
eg:

  • 查询序号为0的RAID控制器下硬盘信息: ./sas3ircu 0 display
  • 查询序号为0的RAID控制器下硬盘信息:./sas3ircu 1 display
node5:~/test/SAS3IRCU_P12/sas3ircu_linux_x64_rel # ./sas3ircu 0 display
Avago Technologies SAS3 IR Configuration Utility.
Version 13.00.00.00 (2016.03.08) 
Copyright (c) 2009-2016 Avago Technologies. All rights reserved. 

Read configuration has been initiated for controller 0
………………
------------------------------------------------------------------------
Physical device information
------------------------------------------------------------------------
Initiator at ID #0

Device is a Hard disk
  Enclosure #                             : 1
  Slot #                                  : 0
  SAS Address                             : 5000cca-0-b00e-a90d
  State                                   : Optimal (OPT)
  Size (in MB)/(in sectors)               : 1144641/2344225967
  Manufacturer                            : HGST    
  Model Number                            : HUC101812CSS200 
  Firmware Revision                       : AD02
  Serial No                               : 4ZG81Y7Z
  Unit Serial No(VPD)                     : 4ZG81Y7Z
  GUID                                    : 5000cca0b00ea90c
  Protocol                                : SAS
  Drive Type                              : SAS_HDD
………………

根据硬盘序列号去筛选硬盘所在槽位,首先确定要查看的硬盘盘符是哪个(lsblk可以查看)

smartctl查看硬盘信息

node5:~/test/SAS3IRCU_P12/sas3ircu_linux_x64_rel # smartctl -i /dev/sdn
smartctl 6.6 2017-11-05 r4594 [x86_64-linux-4.4.143-94.47-default] (SUSE RPM)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Enterprise Capacity 3.5 HDD
Device Model:     ST6000NM0115-1YZ110
Serial Number:    ZAD6G5QD
LU WWN Device Id: 5 000c50 0b33c90e3
Firmware Version: SN04
User Capacity:    6,001,175,126,016 bytes [6.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Form Factor:      3.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-3 T13/2161-D revision 5
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Thu Nov  5 15:28:48 2020 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

其中 Serial NumberZAD6G5QD 代表的是硬盘序列号
筛选sas3ircu输出信息

node5:~/test/SAS3IRCU_P12/sas3ircu_linux_x64_rel # ./sas3ircu 0 display |grep ZAD6G5QD
node5:~/test/SAS3IRCU_P12/sas3ircu_linux_x64_rel # 

说明该硬盘不在RAID控制器0下,查询控制器1

grep -C 9 代表输出筛选字段所在行的前后各9行

node5:~/test/SAS3IRCU_P12/sas3ircu_linux_x64_rel # ./sas3ircu 1 display |grep ZAD6G5QD
  Serial No                               : ZAD6G5QD
  Unit Serial No(VPD)                     : ZAD6G5QD
node5:~/test/SAS3IRCU_P12/sas3ircu_linux_x64_rel # ./sas3ircu 1 display |grep ZAD6G5QD -C 9
Device is a Hard disk
  Enclosure #                             : 1
  Slot #                                  : 0
  SAS Address                             : 4433221-1-0000-0000
  State                                   : Ready (RDY)
  Size (in MB)/(in sectors)               : 5723166/11721045167
  Manufacturer                            : ATA     
  Model Number                            : ST6000NM0115-1YZ
  Firmware Revision                       : SN04
  Serial No                               : ZAD6G5QD
  Unit Serial No(VPD)                     : ZAD6G5QD
  GUID                                    : 5000c500b33c90e3
  Protocol                                : SATA
  Drive Type                              : SATA_HDD

Device is a Hard disk
  Enclosure #                             : 1
  Slot #                                  : 1
  SAS Address                             : 4433221-1-0100-0000
  State                                   : Ready (RDY)

其中 Slot项 代表的就是硬盘槽位,所以该硬盘槽位为第二个RAID控制器中的0

二、使用storcli64命令查看硬盘槽位

文件也上传在我的资源里了:https://download.csdn.net/download/weixin_43860781/13089959
也可以在官网下载:https://www.broadcom.cn/site-search?q=storcli

这个和sas3ircu使用方式不一样,是一个rpm包,需要安装

将STORCLI_SAS3.5_P16.zip文件上传至系统中解压

mkdir /home/test && cd /home/test
unzip STORCLI_SAS3.5_P16.zip

根据本身环境系统选择对应的目录和rpm包安装

$ cd univ_viva_cli_rel/Unified_storcli_all_os/
$ ls
ARM  EFI  FreeBSD  JSON-Schema  Linux  Linux-PPC  Ubuntu  VMware  Windows  readme.txt  storcliconf.ini
$ cd Linux
$ ls
license.txt  pubKey.asc  splitpackage.sh  storcli-007.1504.0000.0000-1.noarch.rpm

安装
$ rpm -ivh storcli-007.1504.0000.0000-1.noarch.rpm

默认安装在/opt/MegaRAID/storcli目录下
$ cd /opt/MegaRAID/storcli
$ ls
storcli64

使用storcli64命令查看硬盘信息

$ ./storcli64 /c0 show all
...........
Drive /c0/s7 :
============

--------------------------------------------------------------------------
EID:Slt DID State DG     Size Intf Med SED PI SeSz Model               Sp 
--------------------------------------------------------------------------
 :7       4 UGood -  5.456 TB SATA HDD N   N  512B ST6000NM0115-1YZ110 U  
--------------------------------------------------------------------------

EID-Enclosure Device ID|Slt-Slot No.|DID-Device ID|DG-DriveGroup
UGood-Unconfigured Good|UBad-Unconfigured Bad|Intf-Interface
Med-Media Type|SED-Self Encryptive Drive|PI-Protection Info
SeSz-Sector Size|Sp-Spun|U-Up|D-Down|T-Transition


Drive /c0/s7 - Detailed Information :
===================================

Drive /c0/s7 State :
==================
Shield Counter = 0
Media Error Count = 0
Other Error Count = 0
Predictive Failure Count = 0
S.M.A.R.T alert flagged by drive = No

其中 Drive /c0/s7 中c是controller的缩写,0即为第几个RAID控制器;s是slot的缩写,故7就是硬盘槽位

其中也包含了硬盘类信息

--------------------------------------------------------------------------
EID:Slt DID State DG     Size Intf Med SED PI SeSz Model               Sp 
--------------------------------------------------------------------------
 :7       4 UGood -  5.456 TB SATA HDD N   N  512B ST6000NM0115-1YZ110 U  
--------------------------------------------------------------------------

SATA!!即代表这是SATA接口类型硬盘 HDD!!即代表就是机械硬盘了

有时候c0查不到信息

那么我们可以用./storcli64 /call show all来查看全部控制器,就可以查看到了

补充: 甚至有的服务器这样也查询不到。。那就./storcli64 /call/eall/sall show all 肯定就能看到了

根据硬盘序列号查看对应的硬盘槽位

node5:/opt/MegaRAID/storcli # ./storcli64 /c0 show all |grep ZAD6G5QD
node5:/opt/MegaRAID/storcli # ./storcli64 /c1 show all |grep ZAD6G5QD
SN = ZAD6G5QD
node5:/opt/MegaRAID/storcli # ./storcli64 /c1 show all |grep ZAD6G5QD -C 10
Other Error Count = 0
Predictive Failure Count = 0
S.M.A.R.T alert flagged by drive = No


Drive /c1/s0 Device attributes :
==============================
Manufacturer Id = ATA     
Model Number = ST6000NM0115-1YZ110
NAND Vendor = NA
SN = ZAD6G5QD
WWN = 5000C500B33C90E3
Firmware Revision = SN04
Raw size = 5.458 TB [0x2baa0f4af Sectors]
Coerced size = 5.458 TB [0x2baa0f4af Sectors]
Non Coerced size = 5.458 TB [0x2baa0f4af Sectors]
Device Speed = Unknown
Link Speed = 6.0Gb/s
NCQ setting = N/A
Sector Size = 512B
Config ID = NA

所以,序列号为ZAD6G5QD的硬盘,位于/c1/s0,即排序为1的RAID控制器的0槽位

End………

你可能感兴趣的:(Linux底层,知识碎片,linux,服务器)