Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1885982
  • 博文数量: 389
  • 博客积分: 7877
  • 博客等级: 少将
  • 技术积分: 4521
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-10 14:02
文章分类

全部博文(389)

文章存档

2024年(1)

2022年(1)

2021年(1)

2020年(1)

2019年(1)

2018年(3)

2017年(6)

2016年(4)

2015年(8)

2014年(15)

2013年(31)

2012年(19)

2011年(47)

2010年(33)

2009年(105)

2008年(109)

2007年(4)

分类: LINUX

2013-04-18 10:22:22

第一次接触这个命令, 感觉这个命令非常强大,可回头在网上google了好多,发现讲这个命令的用法的并不多,多数也是在用它来查询WWN号

有一篇博客倒是提到了 查看HBA卡信息、判定HBA卡所连接的SAN Switch及SAN Switch的端口

这个功能倒还蛮强大的,这篇文章讲的也比较详细,地址在这里:




Linux存储管理之信息收集

 无论是哪个行业,哪种应用,数据对于企业来说十分重要。大量的数据产生,本地存储已经不能够满足大量数据保存,必需使用独立的存储系统。作为系统(服务 器)管理员,应该非常清楚存储架构、磁盘多路径,非常清楚服务器是怎么与存储系统相连接的。Linux是一个应用非常广泛的服务器操作系统。本文简单介绍 一下如何在Linux系统中进行存储相关信息的收集。

  一、查看HBA卡信息、判定HBA卡所连接的SAN Switch及SAN Switch的端口

  systool -cfc_host命令用来查看Linux系统中已安装的HBA的配置信息:
[root@Redhat ~]# systool -cfc_host -v | grep -iE "port_|class"
Class = "fc_host"
  Class Device = "host0"
  Class Device path = "/sys/class/fc_host/host0"
    port_id             = "0x010000"
    port_name           = "0x5001438004bed3d4"
    port_state          = "Online"
    port_type           = "NPort (fabric via point-to-point)"
    supported_classes   = "Class 3"
  Class Device = "host1"
  Class Device path = "/sys/class/fc_host/host1"
    port_id             = "0x020000"
    port_name           = "0x5001438004bed3d6"
    port_state          = "Online"
    port_type           = "NPort (fabric via point-to-point)"
    supported_classes   = "Class 3"
  Class Device = "host2"
  Class Device path = "/sys/class/fc_host/host2"
    port_id             = "0x011000"
    port_name           = "0x5001438004becff8"
    port_state          = "Online"
    port_type           = "NPort (fabric via point-to-point)"
    supported_classes   = "Class 3"
  Class Device = "host3"
  Class Device path = "/sys/class/fc_host/host3"
    port_id             = "0x021000"
    port_name           = "0x5001438004becffa"
    port_state          = "Online"
    port_type           = "NPort (fabric via point-to-point)"
    supported_classes   = "Class 3"
[root@Redhat ~]#

  由上面systool -cfc_host的命令输出结果可以看出,系统中安装了四块HAB卡,对应的名称分别是:host0、host1
、host2、host3。port_name是HBA卡的WWN号,由HBA卡的port_id号可以判断它所连接的SAN Switch的Domain ID及portindex:
  host0的port ID是0x010000,由此判定它所连接的SAN Switch的Domain ID是1,portindex是0
  host1的port ID是0x020000,由此判定它所连接的SAN Switch的Domain ID是2,portindex是0
  host2的port ID是0x011000,由此判定它所连接的SAN Switch的Domain ID是1,portindex是16(十六进制的10转化为十进制就是16)
  host3的port ID是0x021000,由此判定它所连接的SAN Switch的Domain ID是2,portindex是16。
  host0、1、2、3这四个HBA卡的WWN号分别是:0x5001438004bed3d4、0x5001438004bed3d6、0x5001438004becff8及0x5001438004becffa。

  二、登录到主机所连接的SAN Switch上收集相关信息

  登录到Domain ID为1与2的SAN Switch上验证上面的判定:

  先简单了解一下SAN Switch的信息:
san1:FID128:admin> switchshow -portcount
FC ports =  448
san1:FID128:admin> version
Kernel:     2.6.14.2  
Fabric OS:  v6.4.1b
Made on:    Wed Mar 2 01:25:37 2011
Flash:      Wed Jun 22 08:27:13 2011
BootProm:   1.0.15
san1:FID128:admin> slotshow 

Slot   Blade Type     ID    Status
-----------------------------------
  1     SW BLADE     51     ENABLED
  2     SW BLADE     51     ENABLED
  3     SW BLADE     51     ENABLED
  4     SW BLADE     51     ENABLED
  5     CORE BLADE   52     ENABLED
  6     CP BLADE     50     ENABLED
  7     CP BLADE     50     ENABLED
  8     CORE BLADE   52     ENABLED
  9     SW BLADE     51     ENABLED
 10     SW BLADE     51     ENABLED
 11     SW BLADE     51     ENABLED
 12     SW BLADE     51     ENABLED
 
  需要注意的是在Brocade SAN Switch中,WWN号的形式是每两位之间由:号隔开。
san1:FID128:admin> switchshow | grep "50:01:43:80:04:be:d3:d4"
  0    1    0   010000   id    N4   Online      FC  F-Port  50:01:43:80:04:be:d3:d4
 
 50:01:43:80:04:be:d3:d4是host0的WWN号,由上面的输出信息可以看出这个HAB卡连接在SAN Switch的slot1 blade的0物理端口,portindex是0,port_id是010000,这些信息与在Linux系统中查看到的数据是一致的。其它三个HBA卡 在SAN Switch中的验证信息如下:
san1:FID128:admin> switchshow | grep "50:01:43:80:04:be:cf:f8"
 16    2    0   011000   id    N4   Online      FC  F-Port  50:01:43:80:04:be:cf:f8
  第三块HBA卡与第一块HBA卡都连接到Domain ID为1的SAN Switch上,第三块HBA卡(host2)连接到slot2的物理端口0上,portindex是16。
  第二块HBA卡(host1)与第二块HBA卡(host3)连接到Domain ID为2的SAN Switch上:
san2:FID128:admin> switchshow | grep "50:01:43:80:04:be:d3:d6"
  0    1    0   020000   id    N4   Online      FC  F-Port  50:01:43:80:04:be:d3:d6
san2:FID128:admin> switchshow | grep "50:01:43:80:04:be:cf:fa"
 16    2    0   021000   id    N4   Online      FC  F-Port  50:01:43:80:04:be:cf:fa
 
 主机的HBA卡连接到SAN Switch的端口信息已经知道了,接下来查看zone的信息,判定主机与哪个存储相连。在这里要提醒的是在配置zone时,一定要注意zone名字的选 择,做到见名知意,zone名最好包含主机名与存储标识符,创建zone时可以使用端口号(或者portidex),也可以使用WWN。本例中,zone 成员使用的portindex号。
san2:FID128:admin> configshow | grep "^zone" | grep Redhat
zone.Redhat_1_eva44_12_c1_p1:2,143;2,0
zone.Redhat_1_eva44_13_c1_p1:2,256;2,0
zone.Redhat_1_eva44_14_c1_p1:2,257;2,0
zone.Redhat_1_eva44_15_c1_p1:2,258;2,0
zone.Redhat_1_eva44_16_c1_p2:2,259;2,0
zone.Redhat_1_eva44_17_c1_p2:2,260;2,0
zone.Redhat_1_eva44_18_c1_p2:2,261;2,0
zone.Redhat_1_eva44_19_c1_p2:2,262;2,0
zone.Redhat_2_eva44_12_c2_p1:2,159;2,16
zone.Redhat_2_eva44_13_c2_p1:2,272;2,16
zone.Redhat_2_eva44_14_c2_p1:2,273;2,16
zone.Redhat_2_eva44_15_c2_p1:2,274;2,16
zone.Redhat_2_eva44_16_c2_p2:2,275;2,16
zone.Redhat_2_eva44_17_c2_p2:2,276;2,16
zone.Redhat_2_eva44_18_c2_p2:2,277;2,16
zone.Redhat_2_eva44_19_c2_p2:2,278;2,16
zone.Redhat_3_eva44_10_c2_p2:2,157;2,16
zone.Redhat_3_eva44_11_c2_p2:2,158;2,16
zone.Redhat_3_eva44_5_c2_p1:2,152;2,16
zone.Redhat_3_eva44_6_c2_p1:2,153;2,16
zone.Redhat_3_eva44_7_c2_p1:2,154;2,16
zone.Redhat_3_eva44_8_c2_p2:2,155;2,16
zone.Redhat_3_eva44_9_c2_p2:2,156;2,16
zone.Redhat_4_eva44_10_c1_p2:2,141;2,0
zone.Redhat_4_eva44_11_c1_p2:2,142;2,0
zone.Redhat_4_eva44_5_c1_p1:2,136;2,0
zone.Redhat_4_eva44_6_c1_p1:2,137;2,0
zone.Redhat_4_eva44_7_c1_p1:2,138;2,0
zone.Redhat_4_eva44_8_c1_p2:2,139;2,0
zone.Redhat_4_eva44_9_c1_p2:2,140;2,0

  三、Linux multipath多路径信息查看

  在一块磁盘有多条路径时,通常,一个HBA卡只提供一条路径。如果多路径管理软件是multipath,可以使用multipah -ll命令查看磁盘多路径的信息,查看HBA提供了哪条路径。
[root@Redhat ~]# multipath -ll | more
disk07_04 (3600508b4000af5370001100000440000) dm-162 HP,HSV300
[size=400G][features=1 queue_if_no_path][hwhandler=0]
\_ round-robin 0 [prio=0][active]
 \_ 3:0:12:4  sdaga      69:928  [active][ready]
 \_ 0:0:12:4  sdnc       70:480  [active][ready]
 \_ 1:0:12:4  sdnd       70:496  [active][ready]
 \_ 2:0:12:4  sdzu       131:640 [active][ready]
disk06_07 (3600508b4000dc4a30000600000500000) dm-149 HP,HSV300
[size=400G][features=1 queue_if_no_path][hwhandler=0]
\_ round-robin 0 [prio=0][active]
 \_ 3:0:11:7  sdafo      68:992  [active][ready]
 \_ 1:0:11:7  sdme       69:352  [active][ready]
 \_ 0:0:11:7  sdmf       69:368  [active][ready]
 \_ 2:0:11:7  sdzi       130:704 [active][ready]
  在上面的输出结果中可以看出,四个HBA卡,一个HBA前卡提供一条路径,每条路径前面的数字代表的上HBA卡的编号,3,表示是host3,1,表卡示是host1。 由此可以判定HBA卡所提供的磁盘路径。


阅读(3097) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~