How to identify the HBA cards/ports and WWN in Linux
There are several commands to determine the WWN of a Fibre Channel (FC) HBA and their status (online/offline). The post discusses few of the most commonly used methods.
Method 1
To find the HBA cards installed on your system use :
# lspci -nn | grep -i hba 07:00.0 Fibre Channel [0c04]: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA [1077:2532] (rev 02) 07:00.1 Fibre Channel [0c04]: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA [1077:2532] (rev 02)
To check the available HBA ports :
# ls -l /sys/class/fc_host total 0 drwxr-xr-x 3 root root 0 Feb 3 2015 host2 drwxr-xr-x 3 root root 0 Feb 3 2015 host3
To find the state of HBA ports (online/offline) :
# more /sys/class/fc_host/host?/port_state :::::::::::::: /sys/class/fc_host/host2/port_state :::::::::::::: Online :::::::::::::: /sys/class/fc_host/host3/port_state :::::::::::::: Online
To find the WWN numbers of the above ports :
# more /sys/class/fc_host/host?/port_name :::::::::::::: /sys/class/fc_host/host2/port_name :::::::::::::: 0x500143802426baf4 :::::::::::::: /sys/class/fc_host/host3/port_name :::::::::::::: 0x500143802426baf6
Method 2 : Using systool
Another useful command to find the information about HBAs is systool. If not already install, you may need to install the sysfsutils package.
# yum install sysfsutils
To check the available HBA ports :
# systool -c fc_host Class = "fc_host" Class Device = "host2" Device = "host2" Class Device = "host3" Device = "host3"
To find the WWNs for the HBA ports :
# systool -c fc_host -v | grep port_name port_name = "0x500143802426baf4" port_name = "0x500143802426baf6"
To check the state of the HBA ports (online/offline) :
# systool -c fc_host -v | grep port_state port_state = "Online" port_state = "Online"
查看FC HBA卡的WWN号
一般是在/sys/class/fc_host/host*/目录下
[root@localhost ~]#cat /sys/class/fc_host/host2/port_name
0x2100001b329240d7
[root@localhost ~]#cat /sys/class/fc_host/host*/port_name
0x2100001b329240d7
查看当前port的状态
[root@localhost ~]#cat /sys/class/fc_host/host2/port_state
Online
查看PORT的端口ID
[root@localhost ~]#cat /sys/class/fc_host/host2/port_id
0x000001
查看port支持的速率
[root@localhost ~]#cat /sys/class/fc_host/host2/supported_speeds
1 Gbit, 2 Gbit, 4 Gbit
[root@localhost ~]#cat /sys/class/fc_host/host2/supported_classes
Class 3
在FC HBA没有插上光纤时
[root@localhost ~]#cat /sys/class/fc_host/host2/speed
unknow
[root@localhost ~]#cat /sys/class/fc_host/host2/port_type
unknow
给FC HBA卡插上光纤线,和其他HBA卡相连时。
[root@localhost ~]#cat /sys/class/fc_host/host2/speed
4 Gbit
[root@localhost ~]#cat /sys/class/fc_host/host2/port_type
LPort (private loop)
和光纤交换机相连时
[root@localhost ~]#cat /sys/class/fc_host/host2/port_type
NPort (fabric via point-to-point)
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 没有源码,如何修改代码逻辑?
· PowerShell开发游戏 · 打蜜蜂
· 在鹅厂做java开发是什么体验
· 凌晨三点救火实录:Java内存泄漏的七个神坑,你至少踩过三个!
2020-06-11 MySQL表与数据向Oracle移植(使用Oracle SQL Developer工具)
2020-06-11 数据库迁移之从oracle 到 MySQL
2020-06-11 Oracle与DB2的区别
2020-06-11 Oracle RAC TAF 无缝failover
2020-06-11 Oracle向MySQL迁移
2020-06-11 Tutorial:Oracle迁移阿里云PolarDB全流程指南
2020-06-11 开启/查看 sql trace