storclie64定位sdx盘符
场景一: jbod盘
定位系统里的sdd盘
对应关系
os命令 | 键值 | 关联关系 | raid卡命令 | 键值 |
---|---|---|---|---|
lsscsi -ui | wwn | = | storcli /c0/ex/sx show all | WWN |
lsscsi | target id | = | storcli /c0/ex/sx show | DID |
smarctl -i /dev/sdx | Serial Number | = | storcli /cx/ex/sx show all | SN |
- 使用命令lsscsi列出系统内scsi设备列表
$ lsscsi -ui
[0:0:0:0] enclosu 500e004aaaaaaa1e - -
[0:0:3:0] disk 5000c500a552ff29 /dev/sda 35000c500a552ff29
[0:0:4:0] disk 5000c500a529c08a /dev/sdb 35000c500a529c08a
[0:0:5:0] disk 5000c500a556a2b7 /dev/sdc 35000c500a556a2b7
[0:0:6:0] disk 5002538f9241f5c4 /dev/sdf SATA_Samsung_SSD_870_S5RRNF1T454654P
[0:0:8:0] disk 5000c500a5399573 /dev/sde SATA_ST8000NM0055-1RM_ZA19BPQG
[0:0:9:0] disk 5002538f42b12a92 /dev/sdl SATA_Samsung_SSD_870_S5SSNF0TB01918V
[0:0:10:0] disk 5000c500a53a8e95 /dev/sdg 35000c500a53a8e95
[0:0:12:0] disk 5000c500a5297786 /dev/sdh 35000c500a5297786
[0:0:13:0] disk 5000c500a5399b96 /dev/sdd SATA_ST8000NM0055-1RM_ZA19BPQ7
[0:0:14:0] disk 5000c500a52a0f39 /dev/sdj 35000c500a52a0f39
[0:2:0:0] disk 6a0043155a0f35122b218e2e0b17fad6 /dev/sdk SAVAGO_AVAGO_00d6fa170b2e8e212b12350f5a154300
Note: 接下来要去raid卡找sdd盘
记录sdd盘的信息
HCTL:
[0:0:13:0]
, target id(T): 13wwn: 5000c500a5399b96
- 查看磁盘的smart信息,获取设备序列号
$ sudo smartctl -i /dev/sdd
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.4.0-137-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Seagate Enterprise Capacity 3.5 HDD
Device Model: ST8000NM0055-1RM112
Serial Number: ZA19BPQ7
LU WWN Device Id: 5 000c50 0a5399b96
Firmware Version: SN03
User Capacity: 8,001,563,222,016 bytes [8.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: Wed Feb 15 11:50:48 2023 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
Note:
可以看到smart信息里LU WWN Device Id: 5 000c50 0a5399b96 和 lsscsi得到的信息是一致的
记录Serial Number: ZA19BPQ7
- 使用storcli命令列出raid卡上全部盘
$ sudo storcli64 /c0/eall/sall show
CLI Version = 007.2309.0000.0000 Sep 16, 2022
Operating system = Linux 5.4.0-137-generic
Controller = 0
Status = Success
Description = Show Drive Information Succeeded.
Drive Information :
=================
-------------------------------------------------------------------------------------
EID:Slt DID State DG Size Intf Med SED PI SeSz Model Sp Type
-------------------------------------------------------------------------------------
0:0 6 JBOD - 931.512 GB SATA SSD N N 512B Samsung SSD 870 QVO 1TB U -
0:1 5 JBOD - 7.277 TB SATA HDD N N 512B ST8000NM0055-1RM112 U -
0:2 3 JBOD - 7.277 TB SATA HDD N N 512B ST8000NM0055-1RM112 U -
0:3 9 JBOD - 7.277 TB SATA SSD N N 512B Samsung SSD 870 QVO 8TB U -
0:4 13 JBOD - 7.277 TB SATA HDD N N 512B ST8000NM0055-1RM112 U -
0:5 10 JBOD - 7.277 TB SATA HDD N N 512B ST8000NM0055-1RM112 U -
0:7 14 JBOD - 7.277 TB SATA HDD N N 512B ST8000NM0055-1RM112 U -
0:8 8 JBOD - 7.277 TB SATA HDD N N 512B ST8000NM0055-1RM112 U -
0:10 4 JBOD - 7.277 TB SATA HDD N N 512B ST8000NM0055-1RM112 U -
0:11 12 JBOD - 7.277 TB SATA HDD N N 512B ST8000NM0055-1RM112 U -
0:14 2 Onln 0 138.766 GB SATA SSD N N 512B INTEL SSDSC2BB150G7 U -
0:15 1 Onln 0 138.766 GB SATA SSD N N 512B INTEL SSDSC2BB150G7 U -
-------------------------------------------------------------------------------------
Note:
jbod盘在控制器上没有DG值
- 查看其中DID为13的盘
e0/s4
$ sudo storcli64 /c0/e0/s4 show all
CLI Version = 007.2309.0000.0000 Sep 16, 2022
Operating system = Linux 5.4.0-137-generic
Controller = 0
Status = Success
Description = Show Drive Information Succeeded.
Drive /c0/e0/s4 :
===============
-------------------------------------------------------------------------------
EID:Slt DID State DG Size Intf Med SED PI SeSz Model Sp Type
-------------------------------------------------------------------------------
0:4 13 JBOD - 7.277 TB SATA HDD N N 512B ST8000NM0055-1RM112 U -
-------------------------------------------------------------------------------
EID=Enclosure Device ID|Slt=Slot No|DID=Device ID|DG=DriveGroup
DHS=Dedicated Hot Spare|UGood=Unconfigured Good|GHS=Global Hotspare
UBad=Unconfigured Bad|Sntze=Sanitize|Onln=Online|Offln=Offline|Intf=Interface
Med=Media Type|SED=Self Encryptive Drive|PI=Protection Info
SeSz=Sector Size|Sp=Spun|U=Up|D=Down|T=Transition|F=Foreign
UGUnsp=UGood Unsupported|UGShld=UGood shielded|HSPShld=Hotspare shielded
CFShld=Configured shielded|Cpybck=CopyBack|CBShld=Copyback Shielded
UBUnsp=UBad Unsupported|Rbld=Rebuild
Drive /c0/e0/s4 - Detailed Information :
======================================
Drive /c0/e0/s4 State :
=====================
Shield Counter = 0
Media Error Count = 0
Other Error Count = 0
Drive Temperature = 36C (96.80 F)
Predictive Failure Count = 0
S.M.A.R.T alert flagged by drive = No
Drive /c0/e0/s4 Device attributes :
=================================
SN = ZA19BPQ7
Manufacturer Id = ATA
Model Number = ST8000NM0055-1RM112
NAND Vendor = NA
WWN = 5000C500A5399B96
Firmware Revision = SN03
Raw size = 7.277 TB [0x3a3812ab0 Sectors]
Coerced size = 7.276 TB [0x3a3706000 Sectors]
Non Coerced size = 7.276 TB [0x3a3712ab0 Sectors]
Device Speed = 6.0Gb/s
Link Speed = 12.0Gb/s
NCQ setting = Enabled
Write Cache = N/A
Logical Sector Size = 512B
Physical Sector Size = 4 KB
Connector Name = Port A & Port B
Drive /c0/e0/s4 Policies/Settings :
=================================
Enclosure position = 1
Connected Port Number = 0(path0)
Sequence Number = 6
Commissioned Spare = No
Emergency Spare = No
Last Predictive Failure Event Sequence Number = 0
Successful diagnostics completion on = N/A
FDE Type = None
SED Capable = No
SED Enabled = No
Secured = No
Cryptographic Erase Capable = No
Sanitize Support = Not supported
Locked = No
Needs EKM Attention = No
PI Eligible = No
Certified = No
Wide Port Capable = No
Multipath = No
Port Information :
================
-----------------------------------------
Port Status Linkspeed SAS address
-----------------------------------------
0 Active 12.0Gb/s 0x500e004aaaaaaa04
-----------------------------------------
Inquiry Data =
5a 0c ff 3f 37 c8 10 00 00 00 00 00 3f 00 00 00
00 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20
41 5a 39 31 50 42 37 51 00 00 00 00 00 00 4e 53
33 30 20 20 20 20 54 53 30 38 30 30 4d 4e 30 30
35 35 31 2d 4d 52 31 31 20 32 20 20 20 20 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 10 80
00 40 00 2f 00 40 00 02 00 02 07 00 ff 3f 10 00
3f 00 10 fc fb 00 10 5c ff ff ff 0f 00 00 07 00
Note:
可以看到SN和WWN
SN = ZA19BPQ7 和smartctl获取到的Serial Number
WWN = 5000C500A5399B96 和smartctl获取到的LU WWN Device Id 及lsscsi获取到的wwn一致
场景二 raid卷组
对应关系
os命令 | 键值 | 关联关系 | raid卡命令 | 键值 |
---|---|---|---|---|
lsblk -d | 盘符 | = | storcli64 /c0/vx show all | OS Drive Name |
smartctl --scan | megaradi,x | = | storcli64 /c0/eall/sall show | DID |
定位sdi盘
- 查看VD列表
$ sudo storcli64 /c0/vall show
CLI Version = 007.2309.0000.0000 Sep 16, 2022
Operating system = Linux 5.4.0-137-generic
Controller = 0
Status = Success
Description = None
Virtual Drives :
==============
---------------------------------------------------------------
DG/VD TYPE State Access Consist Cache Cac sCC Size Name
---------------------------------------------------------------
0/0 RAID1 Optl RW Yes RWBD - ON 138.766 GB
1/1 RAID0 Optl RW Yes RWBD - ON 7.276 TB
6/2 RAID0 Optl RW Yes RWBD - ON 7.276 TB
5/3 RAID0 Optl RW Yes RWBD - ON 7.276 TB
7/4 RAID0 Optl RW Yes RWBD - ON 7.276 TB
8/5 RAID0 Optl RW Yes RWBD - ON 7.276 TB
2/6 RAID0 Optl RW Yes RWBD - ON 7.276 TB
3/7 RAID0 Optl RW Yes RWBD - ON 7.276 TB
4/8 RAID0 Optl RW Yes RWBD - ON 7.276 TB
---------------------------------------------------------------
Note:
每个VD就是一个OS里的设备
- 查看VD2的盘符
$ sudo storcli64 /c0/v2 show all |grep "OS Drive Name"
OS Drive Name = /dev/sdi
Note:
如果OS Drive Name的值是盘符就是对应OS里的盘符
如果OS Drive Name的值是N/A即在OS里没有盘符,可能是磁盘故障或者其他原因
记录DG/VD 的值是6/2 ,下面要用
- 定位这个盘的物理位置
需要用到VD信息里的DG,DG为6
$ sudo storcli64 /c0/eall/sall show
CLI Version = 007.2309.0000.0000 Sep 16, 2022
Operating system = Linux 5.4.0-137-generic
Controller = 0
Status = Success
Description = Show Drive Information Succeeded.
Drive Information :
=================
-------------------------------------------------------------------------------------
EID:Slt DID State DG Size Intf Med SED PI SeSz Model Sp Type
-------------------------------------------------------------------------------------
0:0 6 JBOD - 1.819 TB SATA SSD N N 512B Samsung SSD 870 QVO 2TB U -
0:1 5 Onln 5 7.276 TB SATA HDD N N 512B ST8000NM0055-1RM112 U -
0:2 3 Onln 7 7.276 TB SATA HDD N N 512B ST8000NM0055-1RM112 U -
0:3 9 JBOD - 1.819 TB SATA SSD N N 512B Samsung SSD 870 QVO 2TB U -
0:4 13 Onln 6 7.276 TB SATA HDD N N 512B ST8000NM0055-1RM112 U -
0:5 10 Onln 8 7.276 TB SATA HDD N N 512B ST8000NM0055-1RM112 U -
0:7 14 Onln 1 7.276 TB SATA HDD N N 512B ST8000NM0055-1RM112 U -
0:8 8 Onln 2 7.276 TB SATA HDD N N 512B ST8000NM0055-1RM112 U -
0:10 4 Onln 3 7.276 TB SATA HDD N N 512B ST8000NM0055-1RM112 U -
0:11 12 Onln 4 7.276 TB SATA HDD N N 512B ST8000NM0055-1RM112 U -
0:14 2 Onln 0 138.766 GB SATA SSD N N 512B INTEL SSDSC2BB150G7 U -
0:15 1 Onln 0 138.766 GB SATA SSD N N 512B INTEL SSDSC2BB150G7 U -
-------------------------------------------------------------------------------------
Note:
DG6对应的EID:Slt 是0:4 即物理位置
DG6对应的DID是13 , smartctl命令需要的
- 与smart信息对应
$ sudo smartctl --scan
/dev/sda -d scsi # /dev/sda, SCSI device
/dev/sdb -d scsi # /dev/sdb, SCSI device
/dev/sde -d scsi # /dev/sde, SCSI device
/dev/sdf -d scsi # /dev/sdf, SCSI device
/dev/sdg -d scsi # /dev/sdg, SCSI device
/dev/sdh -d scsi # /dev/sdh, SCSI device
/dev/sdi -d scsi # /dev/sdi, SCSI device
/dev/sdj -d scsi # /dev/sdj, SCSI device
/dev/sdk -d scsi # /dev/sdk, SCSI device
/dev/sdl -d scsi # /dev/sdl, SCSI device
/dev/sdm -d scsi # /dev/sdm, SCSI device
/dev/bus/0 -d megaraid,1 # /dev/bus/0 [megaraid_disk_01], SCSI device
/dev/bus/0 -d megaraid,2 # /dev/bus/0 [megaraid_disk_02], SCSI device
/dev/bus/0 -d megaraid,3 # /dev/bus/0 [megaraid_disk_03], SCSI device
/dev/bus/0 -d megaraid,4 # /dev/bus/0 [megaraid_disk_04], SCSI device
/dev/bus/0 -d megaraid,5 # /dev/bus/0 [megaraid_disk_05], SCSI device
/dev/bus/0 -d megaraid,6 # /dev/bus/0 [megaraid_disk_06], SCSI device
/dev/bus/0 -d megaraid,8 # /dev/bus/0 [megaraid_disk_08], SCSI device
/dev/bus/0 -d megaraid,9 # /dev/bus/0 [megaraid_disk_09], SCSI device
/dev/bus/0 -d megaraid,10 # /dev/bus/0 [megaraid_disk_10], SCSI device
/dev/bus/0 -d megaraid,12 # /dev/bus/0 [megaraid_disk_12], SCSI device
/dev/bus/0 -d megaraid,13 # /dev/bus/0 [megaraid_disk_13], SCSI device
/dev/bus/0 -d megaraid,14 # /dev/bus/0 [megaraid_disk_14], SCSI device
Note:
DID 13 即是这里的megaraid,13
$ sudo smartctl -i /dev/bus/0 -d megaraid,13
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.4.0-137-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Seagate Enterprise Capacity 3.5 HDD
Device Model: ST8000NM0055-1RM112
Serial Number: ZA19BPQ7
LU WWN Device Id: 5 000c50 0a5399b96
Firmware Version: SN03
User Capacity: 8,001,563,222,016 bytes [8.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: Sat Feb 18 09:20:37 2023 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
Note:
记录 Serial Number: ZA19BPQ7
记录 LU WWN Device Id: 5 000c50 0a5399b96
通过storcli查看SN和WWN
$ sudo storcli64 /c0/e0/s4 show all |grep -P '(^SN)|(WWN)'
SN = ZA19BPQ7
WWN = 5000C500A5399B96
Note:
对应smartctl的输出,可以确认是同一个盘
点亮硬盘灯
storcli64 /c0/ex/sx start locate
此时硬盘灯会亮起来
关闭:
storcli64 /c0/ex/sx stop locate