识别逻辑驱动器

识别逻辑驱动器

假设我知道我想要的驱动器位于适配器 8、虚拟驱动器 0 上,有没有办法获取 Linux 设备名称(例如/dev/sdt)?我在 RHEL 6.2 上。

-pdlist显示每个物理驱动器的 WWN 值,但这并没有多大帮助。-ldinfo不打印 WWN 或任何其他标识值。

# ./MegaCli64 -pdlist -a8 | grep WWN
WWN: 500051610003776C
WWN: 5000516100037BFC
WWN: 5000516100038090
WWN: 50005161000284F4
WWN: 5000516100037C0C
WWN: 5000516100037C5C
WWN: 50005161000310C8
WWN: 5000516100037F4C

# ls -1dt /dev/disk/by-id/wwn*
/dev/disk/by-id/wwn-0x600605b0043e52d01721fd142c12c84d
/dev/disk/by-id/wwn-0x600605b0043e52d01721fd142c0973e6
/dev/disk/by-id/wwn-0x600605b0043e52d01721fd132c002573
/dev/disk/by-id/wwn-0x600605b0043e52d01721fd122bf6e2f6
/dev/disk/by-id/wwn-0x600605b0043e52d01721fd122beda52a
/dev/disk/by-id/wwn-0x600605b0043e52d01721fd112be46f10
/dev/disk/by-id/wwn-0x600605b0043e52d01721fd112bdb3ffb
/dev/disk/by-id/wwn-0x600605b0043e52d01721fd102bd20f14

# ./MegaCli64 -v                       
 MegaCLI SAS RAID Management Tool  Ver 8.03.08 Mar 15, 2012

答案1

您应该能够将中的磁盘序列号-pdlist与中的输出进行比较lshw

# MegaCLI -pdlist -a0 | grep "Inquiry Data:"
Inquiry Data:       XXXXXXXXXXXXHitachi YYYYYYYY                 ZZZZZZ
...

然后在输出中搜索lshw序列号。设备名称将显示在logical name字段中。

我无法验证这一点,因为我的所有磁盘都在一个卷中。

识别逻辑驱动器

Target Id将MegaCLI 中的 与设备的 scsi 总线目标进行比较。lshw其中是bus info

# MegaCli -ldinfo -Lall -aall 


Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name                :
RAID Level          : Primary-6, Secondary-0, RAID Level Qualifier-3
Size                : 7.275 TB
State               : Optimal
Strip Size          : 64 KB
Number Of Drives    : 6
Span Depth          : 1
Default Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
Access Policy       : Read/Write
Disk Cache Policy   : Disabled
Ongoing Progresses:
  Check Consistency        : Completed 17%, Taken 89 min.
Encryption Type     : None


Virtual Drive: 1 (Target Id: 1)
Name                :
RAID Level          : Primary-6, Secondary-0, RAID Level Qualifier-3
Size                : 7.275 TB
State               : Optimal
Strip Size          : 64 KB
Number Of Drives    : 6
Span Depth          : 1
Default Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
Access Policy       : Read/Write
Disk Cache Policy   : Disabled
Ongoing Progresses:
  Check Consistency        : Completed 17%, Taken 89 min.
Encryption Type     : None

来自 lshw:

# lshw -class disk
...
              *-enclosure UNCLAIMED
               description: SCSI Enclosure
               product: Bobcat
               vendor: LSI CORP
               physical id: 1.75.0
               bus info: scsi@0:1.117.0
               version: 0504
               configuration: ansiversion=5
          *-disk:0
               description: SCSI Disk
               product: MR9260-16i
               vendor: LSI
               physical id: 2.0.0
               bus info: scsi@0:2.0.0
               logical name: /dev/sda
               version: 2.12
               serial: svDASJ-f8kM-4qp5-BswW-3IKC-DDyA-djz8N7
               size: 7450GiB
               capacity: 7450GiB
               capabilities: lvm2
               configuration: ansiversion=5
          *-disk:1
               description: SCSI Disk
               product: MR9260-16i
               vendor: LSI
               physical id: 2.1.0
               bus info: scsi@0:2.1.0
               logical name: /dev/sdb
               version: 2.12
               serial: NHUvUy-1tm4-aGYW-g6DZ-t1Z9-gxW8-JhvFfL
               size: 7450GiB
               capacity: 7450GiB
               capabilities: lvm2
               configuration: ansiversion=5

答案2

我刚刚为 megaclisas-status 的分支添加了一些支持,用于将逻辑驱动器与 OS Native 设备匹配。以下是示例输出:

$ sudo ./megaclisas-status
-- Controller information --
-- ID | H/W Model                  | RAM    | Temp | Firmware     
c0    | LSI MegaRAID SAS 9271-8i   | 1024MB | 88C  | FW: 23.32.0-0009 
c1    | LSI MegaRAID SAS 9280-4i4e | 512MB  | N/A  | FW: 12.15.0-0205 

-- Array information --
-- ID | Type   |    Size |  Strpsz |   Flags | DskCache |  Status |  OS Path | InProgress   
c0u0  | RAID-1 |   1817G |  256 KB | ADRA,WT |  Enabled | Optimal | /dev/sda | None         
c0u1  | RAID-5 |  16370G |  512 KB | ADRA,WB |  Enabled | Optimal | /dev/sdb | None         
c1u0  | RAID-0 |    476G |  256 KB | ADRA,WT |  Enabled | Optimal | /dev/sdc | None         

-- Disk information --
-- ID   | Type | Drive Model                                  | Size     | Status          | Speed    | Temp | Slot ID  | LSI Device ID
c0u0p0  | HDD  | WD-WMC300422505WDC WD20EFRX-68AX9N0 80.00A80 | 1.817 TB | Online, Spun Up | 6.0Gb/s  | 31C  | [252:4]  | 17      
c0u0p1  | HDD  | WD-WMC300421817WDC WD20EFRX-68AX9N0 80.00A80 | 1.817 TB | Online, Spun Up | 6.0Gb/s  | 31C  | [252:5]  | 18      
c0u1p0  | HDD  | WD-WX41DA40LCE5WDC WD60EFRX-68MYMN1 82.00A82 | 5.456 TB | Online, Spun Up | 6.0Gb/s  | 32C  | [252:0]  | 15      
c0u1p1  | HDD  | WD-WX41DA40L42RWDC WD60EFRX-68MYMN1 82.00A82 | 5.456 TB | Online, Spun Up | 6.0Gb/s  | 31C  | [252:1]  | 12      
c0u1p2  | HDD  | WD-WX61DA4HAKFZWDC WD60EFRX-68MYMN1 82.00A82 | 5.456 TB | Online, Spun Up | 6.0Gb/s  | 32C  | [252:6]  | 14      
c0u1p3  | HDD  | WD-WX41DA40LEF1WDC WD60EFRX-68MYMN1 82.00A82 | 5.456 TB | Online, Spun Up | 6.0Gb/s  | 31C  | [252:7]  | 16      
c1u0p0  | SSD  | 0000000011310344CFE3M4-CT512M4SSD2 070H      | 476.4 Gb | Online, Spun Up | 6.0Gb/s  | N/A  | [252:1]  | 11      

-- Unconfigured Disk information --

该工具本身可从以下位置获取: http://step.polymtl.ca/~coyote/dist/megaclisas-status/megaclisas-status

我希望这有帮助,

文森特

答案3

对于任何遇到此问题并使用storcli(的后继MegaCLI)的人,您可以使用以下命令将虚拟驱动器映射到操作系统看到的磁盘:

$ /opt/MegaRAID/storcli/storcli64 /c0/v0 show all | grep NAA
SCSI NAA Id = 6001676001750006201086de0bd7f605
$ ls -al /dev/disk/by-id/ | grep wwn-0x6001676001750006201086de0bd7f605
lrwxrwxrwx 1 root root   9 Jan 23 10:55 wwn-0x6001676001750006201086de0bd7f605 -> ../../sdk

已通过以下下载进行测试storcli-1.21.06https://docs.broadcom.com/docs/1.21.06_StorCLI

答案4

我最近在多个新服务器上处理这个问题,并想出了一个解决方案!我们没有在“RAID”卡上使用 RAID,只是将 SAS 驱动器用作 JBOD。映射/dev/disk/by-id与 相差一个(或几个)SAS Address。这似乎很奇怪,但它在我测试过的数十台服务器上都有效。我还收到了独立确认这对其他人也有效。

大地图sd*是一个简短的 Perl 脚本,用于实现上述发现。它生成 Linux 驱动器到 MegaRaid 驱动器 ID的映射,并显示 Linux 的 WWN。在生产中使用一段时间后,我还添加了megablinkmegaunblink用于控制“来修复我”闪烁的 LED。该功能让我免于从服务器中拔出错误的驱动器。请在github

标识[图片感谢斯科特·弗拉布尔]

相关内容