Linux下查看FC HBA信息

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

一、lspci 指令查看HBA卡信息

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

[boco4a@361way.com ~]$ lspci|grep -i Fibre
44:00.0 Fibre Channel: Emulex Corporation Saturn-X: LightPulse Fibre Channel Host Adapter (rev 03)
44:00.1 Fibre Channel: Emulex Corporation Saturn-X: LightPulse Fibre Channel Host Adapter (rev 03)

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

[root@361way.com ~]# lspci -vvv|grep -i Fibre -A 100
44:00.0 Fibre Channel: Emulex Corporation Saturn-X: LightPulse Fibre Channel Host Adapter (rev 03)
        Subsystem: Hewlett-Packard Company Device 3282
        Physical Slot: 8
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR- FastB2B- DisINTx+
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0, Cache Line Size: 64 bytes
        Interrupt: pin A routed to IRQ 64
        Region 0: Memory at f8df0000 (64-bit, non-prefetchable) [size=4K]
        Region 2: Memory at f8de0000 (64-bit, non-prefetchable) [size=16K]
        [virtual] Expansion ROM at f8800000 [disabled] [size=256K]
        Capabilities: [58] Power Management version 3
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
        Capabilities: [60] MSI: Enable- Count=1/16 Maskable+ 64bit+
                Address: 0000000000000000  Data: 0000
                Masking: 00000000  Pending: 00000000
        Capabilities: [78] MSI-X: Enable+ Count=32 Masked-
                Vector table: BAR=2 offset=00002000
                PBA: BAR=2 offset=00003000
        Capabilities: [84] Vital Product Data
                Product Name: AJ763-63003
                Read-only fields:
                        [PN] Part number: AJ763-63003
                        [SN] Serial number: CN64520512
                        [V0] Vendor specific: WC45273528
                        [EC] Engineering changes: A-5442
                        [FN] Unknown: 36 39 37 38 39 30 2d 30 30 31
                        [VA] Vendor specific: 5452
                        [VB] Vendor specific: PW=13.3 W; PCIE X8 GEN 2
                        [V1] Vendor specific: HP 8Gb Dual Channel PCI-e 2.0 FC HBA
                        [V2] Vendor specific: AJ763B/AH403A
                        [V3] Vendor specific: T2:78,T3:79,7A,7B,7D,7E,7F,T7:73,TB:73,TFF:78
                        [V4] Vendor specific: 0
                        [V6] Vendor specific: A0:1,D0:1
                        [RV] Reserved: checksum bad, 19 byte(s) reserved
                End
        Capabilities: [94] Express (v2) Endpoint, MSI 00
                DevCap: MaxPayload 2048 bytes, PhantFunc 0, Latency L0s <1us, L1 unlimited
                        ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
                DevCtl: Report errors: Correctable+ Non-Fatal+ Fatal+ Unsupported+
                        RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+
                        MaxPayload 128 bytes, MaxReadReq 4096 bytes
                DevSta: CorrErr+ UncorrErr- FatalErr+ UnsuppReq+ AuxPwr- TransPend-
                LnkCap: Port #0, Speed 5GT/s, Width x8, ASPM L0s, Latency L0 <1us, L1 <64us
                        ClockPM- Surprise- LLActRep- BwNot-
                LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- Retrain- CommClk-
                        ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
                LnkSta: Speed 2.5GT/s, Width x8, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
                DevCap2: Completion Timeout: Range ABCD, TimeoutDis+, LTR-, OBFF Not Supported
                DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
                LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-
                         Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
                         Compliance De-emphasis: -6dB
                LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete-, EqualizationPhase1-
                         EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
        Capabilities: [100 v1] Advanced Error Reporting
                UESta:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq+ ACSViol-
                UEMsk:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq+ ACSViol-
                UESvrt: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
                CESta:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
                CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
                AERCap: First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
        Capabilities: [12c v1] Power Budgeting <?>
        Kernel driver in use: lpfc
        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和Qlogic,将其写成脚本查看型号和firmware如下:

#!/bin/ksh
for SCSI in `ls -d /sys/class/scsi_host/host*`;
do
[ -e ${SCSI}/modelname ] && echo -n 'Model Name ' && cat ${SCSI}/modelname;
[ -e ${SCSI}/model_name ] && echo -n 'Model Name ' && cat ${SCSI}/model_name;
[ -e ${SCSI}/fwrev ] && echo -n 'Firmware Version ' && cat ${SCSI}/fwrev;
[ -e ${SCSI}/fw_version ] && echo -n 'Firmware Version ' && cat ${SCSI}/fw_version;
done

三、systool 工具查看

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

[root@361way.com ~]# rpm -qf /usr/bin/systool
sysfsutils-2.1.0-7.el6.x86_64

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

[root@361way.com ~]#  systool -av -c fc_host
Class = "fc_host"
  Class Device = "host1"
  Class Device path = "/sys/class/fc_host/host1"
    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 "
    fabric_name         = "0x100000051efabe32"
    issue_lip           = <store method only>
    maxframe_size       = "2048 bytes"
    node_name           = "0x2000286ed4233d6a"
    port_id             = "0x010900"
    port_name           = "0x2100286ed4233d6a"
    port_state          = "Online"
    port_type           = "NPort (fabric via point-to-point)"
    speed               = "2 Gbit"
    supported_classes   = "Class 3"
    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 "
    supported_speeds    = "1 Gbit, 2 Gbit, 4 Gbit"
    symbolic_name       = "Emulex FC3532 FV2.72A2 DV8.1.10.3"
    tgtid_bind_type     = "wwpn (World Wide Port Name)"
    uevent              = <store method only>
    Device = "host1"
    Device path = "/sys/devices/pci0000:00/0000:00:04.0/0000:0b:00.0/host1"
      uevent              = <store method only>
  Class Device = "host2"
  Class Device path = "/sys/class/fc_host/host2"
    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 "
    fabric_name         = "0x100000051efacbcf"
    issue_lip           = <store method only>
    maxframe_size       = "2048 bytes"
    node_name           = "0x2000286ed4233d6b"
    port_id             = "0x010900"
    port_name           = "0x2100286ed4233d6b"
    port_state          = "Online"
    port_type           = "NPort (fabric via point-to-point)"
    speed               = "2 Gbit"
    supported_classes   = "Class 3"
    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 "
    supported_speeds    = "1 Gbit, 2 Gbit, 4 Gbit"
    symbolic_name       = "Emulex FC3532 FV2.72A2 DV8.1.10.3"
    tgtid_bind_type     = "wwpn (World Wide Port Name)"
    uevent              = <store method only>
    Device = "host2"
    Device path = "/sys/devices/pci0000:00/0000:00:04.0/0000:0b:00.1/host2"
      uevent              = <store method only>

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

四、官方工具

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

上面查看的几台都是Emulex的HBA卡,这里以SANsurfer查看Qlogic的为例:

SANsurfer

参考页面:

setaoffice HBA卡相关页面

EMC 论坛

浅谈主机FC-HBA卡更换




本站的发展离不开您的资助,金额随意,欢迎来赏!

You can donate through PayPal.
My paypal id: itybku@139.com
Paypal page: https://www.paypal.me/361way

分类: Linux/unix/mac 标签:
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.