主机安装HBA卡驱动,一般光纤卡的厂家就是QLogic和Emulex的。
Linux下查看光纤卡驱动模块是否加载通过
lsmod |grep qla2xxx #查看是否加载了QLogic的光纤卡模块 lsmod |grep lpfc #查看是否加载了Emulex的光纤卡模块 modprobe lpfc #加载相应的光纤卡模块
Windows下查看设备管理器查看是否加载了驱动(如果没有的话安装相应的光纤卡驱动)。
2. 查看光纤卡的WWN号(记录下来为存储设备映射时使用)
Linux
more /sys/class/fc_host/host1/node_name #根据光纤卡端口的数量可能会有host1,host2等。
Windows
wmic /namespace:\\root\wmi path MSFC_FCAdapterHBAAttributes get /value #查看PortWWN号码,是10进制的,需要转换到16进制(其实一般只需要把最后的号码转换一下,在存储设备中能够识别出来是那台主机即可)
3. 存储设备映射卷到主机
FC存储设备是通过WWN号来识别主机的,此处把划出来的卷分配给相应主机的WWN号码即可。
4. 安装多路径软件
Linux
yum list |grep device-mapper #查找多路径包 yum install device-mapper-multipath #CentOS下安装多路径软件
suse 通过yast或zypper安装,Ubuntu 通过 apt-get安装。两个包:device-mapper和device-mapper-multipath包。搜索一下安装这两个包,名字各版本可能有差别。
Windows 2008以上
服务器管理--功能--添加功能--选择Multipath IO包安装。然后选择管理员工具-MPIO--发现多路径选项卡--添加即可,重启后即可看到效果。
5. Linux多路径配置文件
centos 5.x
修改/etc/multipath.conf
defaults { udev_dir /dev polling_interval 10 selector "round-robin 0" path_grouping_policy failover getuid_callout "/sbin/scsi_id -g -u -s /block/%n" prio_callout "/bin/true" path_checker tur rr_min_io 100 rr_weight uniform failback immediate no_path_retry 12 user_friendly_names yes } blacklist { devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*" devnode "^hd[a-z][[0-9]*]" } devices { device { vendor "HP|COMPAQ" product "HSV1[01]1 \(C\)COMPAQ|HSV2[01]0|HSV300|HSV4[05]0" path_grouping_policy group_by_prio getuid_callout "/sbin/scsi_id -g -u -s /block/%n" path_checker tur path_selector "round-robin 0" prio_callout "/sbin/mpath_prio_alua /dev/%n" rr_weight uniform failback immediate hardware_handler "0" no_path_retry 18 rr_min_io 100 } device { vendor "HP" product "P2000 G3 FC|P2000G3 FC/iSCSI" path_grouping_policy group_by_prio getuid_callout "/sbin/scsi_id -g -u -s /block/%n" path_checker tur path_selector "round-robin 0" prio_callout "/sbin/mpath_prio_alua /dev/%n" rr_weight uniform failback immediate hardware_handler "0" no_path_retry 18 rr_min_io 100 } device { vendor "HP" product "OPEN-.*" path_grouping_policy multibus getuid_callout "/sbin/scsi_id -g -u -s /block/%n" path_selector "round-robin 0" rr_weight uniform path_checker tur hardware_handler "0" failback immediate no_path_retry 18 rr_min_io 1000 } device { vendor "HP" product "MSA VOLUME*" path_grouping_policy group_by_prio getuid_callout "/sbin/scsi_id -g -u -s /block/%n" path_checker tur path_selector "round-robin 0" prio_callout "/sbin/mpath_prio_alua /dev/%n" rr_weight uniform failback immediate hardware_handler "0" no_path_retry 18 rr_min_io 100 } device { vendor "HP" product "MSA2012sa|MSA2312sa|MSA2324sa" path_grouping_policy group_by_prio getuid_callout "/sbin/hp_scsi_id -g -u -n -s /block/%n" path_checker tur path_selector "round-robin 0" prio_callout "/sbin/mpath_prio_alua %d" rr_weight uniform failback immediate hardware_handler "0" no_path_retry 18 rr_min_io 100 } device { vendor "HP" product "MSA2312fc|MSA2324fc|MSA2312i|MSA2324i" path_grouping_policy group_by_prio getuid_callout "/sbin/scsi_id -g -u -s /block/%n" path_checker tur path_selector "round-robin 0" prio_callout "/sbin/mpath_prio_alua /dev/%n" rr_weight uniform failback immediate hardware_handler "0" no_path_retry 18 rr_min_io 100 } device { vendor "HP" product "MSA2[02]12fc|MSA2012i" path_grouping_policy multibus getuid_callout "/sbin/scsi_id -g -u -s /block/%n" path_selector "round-robin 0" rr_weight uniform path_checker tur hardware_handler "0" failback immediate no_path_retry 18 rr_min_io 100 } }
centos 6.x-7.0
mpathconf --enable --with_multipathd y #简化了配置,同样也可以使用5.x的配置文件
suse
defaults { udev_dir /dev polling_interval 10 selector "round-robin 0" path_grouping_policy failover getuid_callout "/lib/udev/scsi_id -g -u /dev/%n" prio const path_checker tur rr_min_io 100 rr_weight uniform failback immediate no_path_retry 12 user_friendly_names yes } blacklist { devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*" devnode "^hd[a-z][[0-9]*]" } devices { device { vendor "HP|COMPAQ" product "HSV1[01]1 \(C\)COMPAQ|HSV2[01]0|HSV300|HSV4[05]0" path_grouping_policy group_by_prio getuid_callout "/lib/udev/scsi_id -g -u /dev/%n" path_checker tur path_selector "round-robin 0" prio alua rr_weight uniform failback immediate hardware_handler "0" no_path_retry 18 rr_min_io 100 } device { vendor "HP" product "P2000 G3 FC|P2000G3 FC/iSCSI" path_grouping_policy group_by_prio getuid_callout "/lib/udev/scsi_id -g -u /dev/%n" path_checker tur path_selector "round-robin 0" prio alua rr_weight uniform failback immediate hardware_handler "0" no_path_retry 18 rr_min_io 100 } device { vendor "HP" product "OPEN-.*" path_grouping_policy multibus getuid_callout "/lib/udev/scsi_id -g -u /dev/%n" path_selector "round-robin 0" rr_weight uniform path_checker tur hardware_handler "0" failback immediate no_path_retry 18 rr_min_io 1000 } device { vendor "HP" product "MSA VOLUME*" path_grouping_policy group_by_prio getuid_callout "/lib/udev/scsi_id -g -u /dev/%n" path_checker tur path_selector "round-robin 0" prio alua rr_weight uniform failback immediate hardware_handler "0" no_path_retry 18 rr_min_io 100 } device { vendor "HP" product "MSA2312fc|MSA2324fc|MSA2312i|MSA2324i|MSA2012sa|MSA2312sa|MSA2324sa|MSA2000s VOLUME" path_grouping_policy group_by_prio getuid_callout "/lib/udev/scsi_id -g -u /dev/%n" path_checker tur path_selector "round-robin 0" prio alua rr_weight uniform failback immediate hardware_handler "0" no_path_retry 18 rr_min_io 100 } device { vendor "HP" product "MSA2[02]12fc|MSA2012i" path_grouping_policy multibus getuid_callout "/lib/udev/scsi_id -g -u /dev/%n" path_selector "round-robin 0" rr_weight uniform path_checker tur hardware_handler "0" failback immediate no_path_retry 18 rr_min_io 100 } }
ubuntu
defaults { udev_dir /dev polling_interval 10 selector "round-robin 0" path_grouping_policy failover getuid_callout "/lib/udev/scsi_id -g -u /block/%n" prio_callout "/bin/true" path_checker tur rr_min_io 100 rr_weight uniform failback immediate no_path_retry 12 user_friendly_names yes } blacklist { devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st|sda)[0-9]*" devnode "^hd[a-z][[0-9]*]" devnode "^cciss!c[0-9]d[0-9]*" } devices { device { vendor "HP|COMPAQ" product "HSV1[01]1 \(C\)COMPAQ|HSV2[01]0|HSV3[046]0|HSV4[05]0" path_grouping_policy group_by_prio getuid_callout "/lib/udev/scsi_id -g -u /block/%n" path_checker tur path_selector "round-robin 0" prio_callout "mpath_prio_alua /dev/%n" rr_weight uniform failback immediate hardware_handler "0" no_path_retry 18 rr_min_io 100 } device { vendor "HP" product "P2000 G3 FC|P2000G3 FC/iSCSI" path_grouping_policy group_by_prio getuid_callout "/lib/udev/scsi_id -g -u /block/%n" path_checker tur path_selector "round-robin 0" prio_callout "mpath_prio_alua /dev/%n" rr_weight uniform failback immediate hardware_handler "0" no_path_retry 18 rr_min_io 100 } device { vendor "HP" product "OPEN-.*" path_grouping_policy multibus getuid_callout "/lib/udev/scsi_id -g -u /block/%n" path_selector "round-robin 0" rr_weight uniform path_checker tur hardware_handler "0" failback immediate no_path_retry 18 rr_min_io 1000 } device { vendor "HP" product "MSA VOLUME*" path_grouping_policy group_by_prio getuid_callout "/lib/udev/scsi_id -g -u /block/%n" path_checker tur path_selector "round-robin 0" prio_callout "mpath_prio_alua /dev/%n" rr_weight uniform failback immediate hardware_handler "0" no_path_retry 18 rr_min_io 100 } device { vendor "HP" product "MSA2012sa|MSA2312sa|MSA2324sa" path_grouping_policy group_by_prio getuid_callout "/lib/udev/hp_scsi_id -g -u -n /block/%n" path_checker tur path_selector "round-robin 0" prio_callout "mpath_prio_alua %d" rr_weight uniform failback immediate hardware_handler "0" no_path_retry 18 rr_min_io 100 } device { vendor "HP" product "MSA2312fc|MSA2324fc|MSA2312i|MSA2324i" path_grouping_policy group_by_prio getuid_callout "/lib/udev/scsi_id -g -u /block/%n" path_checker tur path_selector "round-robin 0" prio_callout "mpath_prio_alua /dev/%n" rr_weight uniform failback immediate hardware_handler "0" no_path_retry 18 rr_min_io 100 } device { vendor "HP" product "MSA2[02]12fc|MSA2012i" path_grouping_policy multibus getuid_callout "/lib/udev/scsi_id -g -u /block/%n" path_selector "round-robin 0" rr_weight uniform path_checker tur hardware_handler "0" failback immediate no_path_retry 18 rr_min_io 100 } }
其实各Linux发行版都是使用Redhat开发的multipath包,只是有些命令的位置不同而已。修改一下就可以适用与各linux系统。
具体的配置参数信息请参考:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/
6. Linux 配置多路径命令
centos 5.x
chkconfig --list|grep multipathd #查看多路径服务是否开机启动 chkconfig multipathd on #开机打开多路径服务 service multipathd start #打开多路径服务 multipath #配置多路径 -vn n为数字,可以显示更多信息 multipath -ll #查看多路径设备和信息
其他
multipath multipath -ll
在启用了user_friendly_names配置后设备名为 /dev/mapper/mpathn,其中n为字母,这个是udev映射的可使用的设备,不要直接操作 /dev/dm-n 或是 /dev/mpath/mpathn,因为它们为系统所使用。
7. 排错
multipathd -k #进入交互模式,具体请查看 man multipathd >list|show config >reconfigure >list|show path
小技巧:当存储添加了新的映射时,我们可以使用下面的命令让系统重新识别设备而无需重启。
echo 1 >/sys/class/fc_host/host0/issue_lip echo 1 >/sys/class/fc_host/host1/issue_lip echo "- - -" >/sys/class/scsi_host/host0/scan echo "- - -" >/sys/class/scsi_host/host1/scan
本文出自 “梦想成真” 博客,请务必保留此出处http://zhile.blog.51cto.com/9599674/1579478