问题描述
在SAN网络环境中,Linux服务器上的SCSI设备,如何通过HBA卡,走光纤网络,让其他的服务器使用到这些设备?本文采用SCST - Generic SCSI Target Subsystem for Linux,试图解决该问题。
查看HBA卡的信息
# lspci | grep -i fibre
01:00.0 Fibre Channel: QLogic Corp. ISP2432-based 4Gb Fibre Channel to PCI Express HBA (rev 03)
01:00.1 Fibre Channel: QLogic Corp. ISP2432-based 4Gb Fibre Channel to PCI Express HBA (rev 03)
一块卡上有2个端口。
在/sys/class/fc_host/目录下,可以查看HBA卡信息
# cd /sys/class/fc_host/
# ls
host0 host1 # 有两个端口
# cat ./host1/port_name # 查看端口1的名称
0x2101001b3235b031
# cat ./host1/port_state # 查看端口1的状态
Online
# cat ./host1/speed # 查看端口1的速率
4 Gbit
通过查看host0,host1目录下的属性文件,可以查看HBA的各种信息。
安装systool工具,可以方便的查看HBA信息,该工具在sysfsutils包中。
# rpm -ivh libsysfs-2.1.0-7.el6.x86_64.rpm
# rpm -ivh sysfsutils-2.1.0-7.el6.x86_64.rpm
查看端口名称
# systool -c fc_host -v | grep "port_name"
port_name = "0x2100001b3215b031"
port_name = "0x2101001b3235b031"
查看端口速率
# systool -c fc_host -v | grep "speed"
speed = "unknown"
supported_speeds = "1 Gbit, 2 Gbit, 4 Gbit"
speed = "4 Gbit"
supported_speeds = "1 Gbit, 2 Gbit, 4 Gbit"
查看端口状态
# systool -c fc_host -v
Class = "fc_host"
......
Class Device = "host1"
Class Device path = "/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.1/host1/fc_host/host1"
dev_loss_tmo = "45"
fabric_name = "0xffffffff"
issue_lip = <store method only>
max_npiv_vports = "127"
node_name = "0x2001001b3235b031"
npiv_vports_inuse = "0"
**port_id = "0x0000ef"**
**port_name = "0x2101001b3235b031"**
**port_state = "Online"**
port_type = "Point-To-Point (direct nport connection)"
**speed = "4 Gbit"**
supported_classes = "Class 3"
supported_speeds = "1 Gbit, 2 Gbit, 4 Gbit"
symbolic_name = "QLE2462 FW:v7.03.00 DVR:v8.07.00.08.06.6-k1"
system_hostname = ""
tgtid_bind_type = "wwpn (World Wide Port Name)"
uevent =
vport_create = <store method only>
vport_delete = <store method only>
Device = "host1&