Linux下查看磁盘阵列卡信息[转]
首页 > IT > Debian   作者:eehello  2019年11月1日 16:33 星期五  浏览:4611  字号:   评论:0 条
时间:2019-11-1 16:33   浏览:4611  评论:0 条 


转载自:http://www.361way.com/linux-get-fc-hba-information/4335.html


FC HBA卡概述

        FC HBA,也即Fibre Channel Host Bus Adapter,光纤通道主机适配器,简称光纤适配器。

        在FC网络环境中,主机需要和FC网络、FC存储设备(SAN磁盘阵列)连接时需要使用一种接口卡,就如同连接以太网需要以太网卡一样,这种接口卡就叫做FC HBA,简称FC HBA卡。

        和以太网卡的MAC地址一样,HBA上也有独一无二的标识,:WWN(World Wide Name),FC HBA上的WWN有两种:

① Node WWN(WWNN):每块HBA有其独有的Node WWN;

② Port WWN(WWPN):每块HBA卡上每个port有其独一无二的Port WWN。

        由于通信是通过port进行的,因此多数情况下需要使用WWPN而不是WWNN。 WWN的长度为8bytes,用16进制表示并用冒号分隔,例如:50:06:04:81:D6:F3:45:42



HBA卡是存储和主机之间连接的媒介。在后端存储配置前后,需要通进查看一些HBA卡信息,如HBA卡型号、HBA卡是否online、HBA卡WWN号等。这里汇总几种查看HBA卡的方法。

一、lspci 指令查看HBA卡信息

现在的HBA卡为了速度的保证,一般都是插在pci插槽上的FC HBA卡,这里以常用的FC接口HBA为例,通过lspci 查看:

  1. [boco4a@361way.com ~]$ lspci|grep -i Fibre

  2. 44:00.0 Fibre Channel: Emulex Corporation Saturn-X: LightPulse Fibre Channel Host Adapter (rev 03)

  3. 44:00.1 Fibre Channel: Emulex Corporation Saturn-X: LightPulse Fibre Channel Host Adapter (rev 03)

上面只能看到HBA卡的厂商是Emulex ,具体的型号这里没有列出。这时可以尝试使用lspci -vvv查看更详细的信息,如下:

  1. [root@361way.com ~]# lspci -vvv|grep -i Fibre -A 100

  2. 44:00.0 Fibre Channel: Emulex Corporation Saturn-X: LightPulse Fibre Channel Host Adapter (rev 03)

  3.        Subsystem: Hewlett-Packard Company Device 3282

  4.        Physical Slot: 8

  5.        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR- FastB2B- DisINTx+

  6.        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-

  7.        Latency: 0, Cache Line Size: 64 bytes

  8.        Interrupt: pin A routed to IRQ 64

  9.        Region 0: Memory at f8df0000 (64-bit, non-prefetchable) [size=4K]

  10.        Region 2: Memory at f8de0000 (64-bit, non-prefetchable) [size=16K]

  11.        [virtual] Expansion ROM at f8800000 [disabled] [size=256K]

  12.        Capabilities: [58] Power Management version 3

  13.                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)

  14.                Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-

  15.        Capabilities: [60] MSI: Enable- Count=1/16 Maskable+ 64bit+

  16.                Address: 0000000000000000  Data: 0000

  17.                Masking: 00000000  Pending: 00000000

  18.        Capabilities: [78] MSI-X: Enable+ Count=32 Masked-

  19.                Vector table: BAR=2 offset=00002000

  20.                PBA: BAR=2 offset=00003000

  21.        Capabilities: [84] Vital Product Data

  22.                Product Name: AJ763-63003

  23.                Read-only fields:

  24.                        [PN] Part number: AJ763-63003

  25.                        [SN] Serial number: CN64520512

  26.                        [V0] Vendor specific: WC45273528

  27.                        [EC] Engineering changes: A-5442

  28.                        [FN] Unknown: 36 39 37 38 39 30 2d 30 30 31

  29.                        [VA] Vendor specific: 5452

  30.                        [VB] Vendor specific: PW=13.3 W; PCIE X8 GEN 2

  31.                        [V1] Vendor specific: HP 8Gb Dual Channel PCI-e 2.0 FC HBA

  32.                        [V2] Vendor specific: AJ763B/AH403A

  33.                        [V3] Vendor specific: T2:78,T3:79,7A,7B,7D,7E,7F,T7:73,TB:73,TFF:78

  34.                        [V4] Vendor specific: 0

  35.                        [V6] Vendor specific: A0:1,D0:1

  36.                        [RV] Reserved: checksum bad, 19 byte(s) reserved

  37.                End

  38.        Capabilities: [94] Express (v2) Endpoint, MSI 00

  39.                DevCap: MaxPayload 2048 bytes, PhantFunc 0, Latency L0s <1us, L1 unlimited

  40.                        ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset-

  41.                DevCtl: Report errors: Correctable+ Non-Fatal+ Fatal+ Unsupported+

  42.                        RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+

  43.                        MaxPayload 128 bytes, MaxReadReq 4096 bytes

  44.                DevSta: CorrErr+ UncorrErr- FatalErr+ UnsuppReq+ AuxPwr- TransPend-

  45.                LnkCap: Port #0, Speed 5GT/s, Width x8, ASPM L0s, Latency L0 <1us, L1 <64us

  46.                        ClockPM- Surprise- LLActRep- BwNot-

  47.                LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- Retrain- CommClk-

  48.                        ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-

  49.                LnkSta: Speed 2.5GT/s, Width x8, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-

  50.                DevCap2: Completion Timeout: Range ABCD, TimeoutDis+, LTR-, OBFF Not Supported

  51.                DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled

  52.                LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-

  53.                         Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-

  54.                         Compliance De-emphasis: -6dB

  55.                LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete-, EqualizationPhase1-

  56.                         EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-

  57.        Capabilities: [100 v1] Advanced Error Reporting

  58.                UESta:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq+ ACSViol-

  59.                UEMsk:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq+ ACSViol-

  60.                UESvrt: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-

  61.                CESta:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+

  62.                CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-

  63.                AERCap: First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-

  64.        Capabilities: [12c v1] Power Budgeting <?>

  65.        Kernel driver in use: lpfc

  66.        Kernel modules: lpfc


从上面我们可以看到HBA卡的Product Name(型号)、SN号、PN号、驱动模块(lpfc)等信息。当然还有很多我们看不明白的信息也一并输出了。

注:

1、lspci -vvv操作时,需要使用root权限进行查看,普通用户查看时部分信息会提示无权查看,如Capabilities:<access denied>;

2、lscp -vvv不能保证获取所有FC HBA卡的型号信息,这里只是尽可能详尽的获取信息。当然也有部分FC HBA卡直接在lspci查看时就能获取到;

3、结合modinfo等指令又可以查看目前使用的驱动版本,如(modinfo lpfc |grep -i version)。

二、读取sys文件

sys文件与proc文件有些类似,sys文件主要读取主机的硬件信息,proc主要获取系统层面或性能层面的一些信息。只要系统能识别的硬件,都可以读取相应的sys文件获取相应的信息。这里还是以上面的主机为例:

# HBA是否online和wwn号
[root@361way.com ~]# cat /sys/class/fc_host/host4/port_state
Online
[root@361way.com ~]# cat /sys/class/fc_host/host4/port_name
0x10000090fa9b1724
#查看具体的HBA卡型号信息
[root@361way.com ~]# cat /sys/class/scsi_host/host4/modelname
AJ763B/AH403A
[root@361way.com ~]# cat /sys/class/scsi_host/host4/modeldesc
HP 8Gb Dual Channel PCI-e 2.0 FC HBA
#常看ROM版本
[root@irora09s ~]# cat /sys/class/scsi_host/host4/option_rom_version
5.20x13

注:

1、这里我只查看了sys里的部分信息,更多的信息可以到hostX相应的文件夹里查看 ;

2、HBA卡的链路一般都是成对出现的,即我们平时说的多路径。所以在fc_host和scsi_host 目录下查看到一般会有host4\host5 这样成对的目录链路信息。


备注: 

Emulex的HBA的WWN的第一个数字为1 

Qlogic的HBA的WWN的第一个数字为2 

HP Tachyon HBA的WWN的第一个数字为5 

Qlogic参数 

Connection Options 

0 - Loop only  

1 - Point-to-point only  

2 - Loop preferred,otherwise point-to-point. 

按服务器那边的建议,DAS直连存储时选择loop only,通过光纤交换机连接存储时选择point-to-point only 

Data Rate 

该配置项定义FC端口速率 

0 - 1Gb/s 

1 - 2Gb/s 

2 - Auto



针对两在主机厂商Emulex和Qlogic,将其写成脚本查看型号和firmware如下:

  1. #!/bin/ksh

  2. for SCSI in `ls -d /sys/class/scsi_host/host*`;

  3. do

  4. [ -e ${SCSI}/modelname ] && echo -n 'Model Name ' && cat ${SCSI}/modelname;

  5. [ -e ${SCSI}/model_name ] && echo -n 'Model Name ' && cat ${SCSI}/model_name;

  6. [ -e ${SCSI}/fwrev ] && echo -n 'Firmware Version ' && cat ${SCSI}/fwrev;

  7. [ -e ${SCSI}/fw_version ] && echo -n 'Firmware Version ' && cat ${SCSI}/fw_version;

  8. done

三、systool 工具查看

systool 是系统上一的个查看sys信息的工具,在redhat、suse发行版里都有该工具,其位于sysfsutils rpm包中:

  1. [root@361way.com ~]# rpm -qf /usr/bin/systool

  2. sysfsutils-2.1.0-7.el6.x86_64


这里我又换了一台装有该工具的主机,查看另一个HBA卡的信息,如下:

  1. [root@361way.com ~]#  systool -av -c fc_host

  2. Class = "fc_host"

  3.  Class Device = "host1"

  4.  Class Device path = "/sys/class/fc_host/host1"

  5.    active_fc4s         = "0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 "

  6.    fabric_name         = "0x100000051efabe32"

  7.    issue_lip           = <store method only>

  8.    maxframe_size       = "2048 bytes"

  9.    node_name           = "0x2000286ed4233d6a"

  10.    port_id             = "0x010900"

  11.    port_name           = "0x2100286ed4233d6a"

  12.    port_state          = "Online"

  13.    port_type           = "NPort (fabric via point-to-point)"

  14.    speed               = "2 Gbit"

  15.    supported_classes   = "Class 3"

  16.    supported_fc4s      = "0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 "

  17.    supported_speeds    = "1 Gbit, 2 Gbit, 4 Gbit"

  18.    symbolic_name       = "Emulex FC3532 FV2.72A2 DV8.1.10.3"

  19.    tgtid_bind_type     = "wwpn (World Wide Port Name)"

  20.    uevent              = <store method only>

  21.    Device = "host1"

  22.    Device path = "/sys/devices/pci0000:00/0000:00:04.0/0000:0b:00.0/host1"

  23.      uevent              = <store method only>

  24.  Class Device = "host2"

  25.  Class Device path = "/sys/class/fc_host/host2"

  26.    active_fc4s         = "0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 "

  27.    fabric_name         = "0x100000051efacbcf"

  28.    issue_lip           = <store method only>

  29.    maxframe_size       = "2048 bytes"

  30.    node_name           = "0x2000286ed4233d6b"

  31.    port_id             = "0x010900"

  32.    port_name           = "0x2100286ed4233d6b"

  33.    port_state          = "Online"

  34.    port_type           = "NPort (fabric via point-to-point)"

  35.    speed               = "2 Gbit"

  36.    supported_classes   = "Class 3"

  37.    supported_fc4s      = "0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 "

  38.    supported_speeds    = "1 Gbit, 2 Gbit, 4 Gbit"

  39.    symbolic_name       = "Emulex FC3532 FV2.72A2 DV8.1.10.3"

  40.    tgtid_bind_type     = "wwpn (World Wide Port Name)"

  41.    uevent              = <store method only>

  42.    Device = "host2"

  43.    Device path = "/sys/devices/pci0000:00/0000:00:04.0/0000:0b:00.1/host2"

  44.      uevent              = <store method only>

wwn号、型号、是否在用、速率等信息一目了然。

四、官方工具

这里指的官方不但包括HBA卡原厂提供的工具,还包括后端存储厂商提供的工具,如Emulex的OCmanager工具、Qlogic的SANsurfer工具、EMC 厂商的power path(powermt display)、华赛存储的UltraPath(upTools、hot_add)等----话题扯的稍微有点远了,存储厂商提供的工具一般用于查看多路径信息等,部分工具里可能包含有查看HBA卡信息。



 您阅读这篇文章共花了: 
 本文没有标签!
二维码加载中...
本文作者:eehello      文章标题: Linux下查看磁盘阵列卡信息[转]
本文地址:https://www.eehello.com/?post=255
版权声明:若无注明,本文皆为“点滴记忆---观雨亭”原创,转载请保留文章出处。

返回顶部| 首页| 手气不错| 留言板|后花园

Copyright © 2014-2023 点滴记忆---观雨亭