1. 判断系统是否按照multipath

     rpm -qa|grep device-mapper-multipath

2. 重新加载新增的HBA存储(如果不是HBA存储,不用做这一步)

modprobe -r lpfc
modprobe lpfc

3. 安装multipath

   yum install 
device-mapper-multipath



4. 检查multipath是否正确加载,如果没有加载,运行下面命令,或者重启操作系统

lsmod|grep multipath
[root@Linux01 ~]# lsmod|grep mult
dm_multipath           17649  1 dm_round_robin
dm_mod                 81692  12 dm_multipath,dm_mirror,dm_log
#重新加载驱动
[root@Linux01 ~]# modprobe dm-multipath
[root@Linux01 ~]# modprobe dm-round-robin

5. 设置multipath服务自动启动并启动multipath服务

 chkconfig multipathd on
 service multipathd start



6. multipath基本操作命令

   service multipath start  #启动multipath
   multipath -F                  #删除无效路径
   multipath -v2                #检查路径,合并路径,格式化路径
   multipath -ll                  #检查路径状态



7. 配置/etc/multipath.conf,添加下面内容

blacklist{
devnode "^sda"
}
defaults {
user_friendly_names yes
udev_dir /dev
path_grouping_policy multibus
failback immediate
no_path_retry fail
}

8. 通过scsi_id 命令获取磁盘的wwid

    这里有几点需要注意一下

    1, 首先,通过scsi_id获取wwid的设备名称,必须可以通过fdisk -l命令可以查到的设备

    2.   注意不要使用网上说的那种 /sbin/scsi_id -s -g /block/sdb 这样,查不出来wwid的,改为 /dev/sdb这样就可以了

    3. 关于scsi_id 命令,Linux有个bug,参考 scsi_id does not return WWID for /dev/sda with aacraid driver

https://bugzilla.redhat.com/show_bug.cgi?id=445696

[root@Linux01 ~]# /sbin/scsi_id -u -g /dev/mapper/mpatha
14f504e46494c45526d56564a4b6f2d6a4e66552d77434947
[root@Linux01 ~]# /sbin/scsi_id -u -g /dev/mapper/mpathb
14f504e46494c4552516a6d535a652d637576712d6f726250
[root@Linux01 ~]# /sbin/scsi_id -u -g /dev/mapper/mpathc
14f504e46494c45527a4e387762672d715632712d68396951
[root@Linux01 ~]# /sbin/scsi_id -u -g /dev/mapper/mpathd
14f504e46494c45526a4c5a6b58632d395a56312d42527652
[root@Linux01 ~]# /sbin/scsi_id -u -g /dev/mapper/mpathe
14f504e46494c45526c36694345372d524761642d32736c77



9, 修改multipath.conf配置文件,实现设备的持久化

添加下面内容到配置文件:

multipaths {
        multipath {
                      wwid                    14f504e46494c45526d56564a4b6f2d6a4e66552d77434947
                      alias                   rac-disk-01
                      path_grouping_policy    multibus
                      path_checker            readsector0
                      path_selector           "round-robin 0"
                      failback                manual
                      rr_weight               priorities
                      no_path_retry           5
                  }
        multipath {
                      wwid                    14f504e46494c4552516a6d535a652d637576712d6f726250
                      alias                   rac-disk-02
                      path_grouping_policy    multibus
                      path_checker            readsector0
                      path_selector           "round-robin 0"
                      failback                manual
                      rr_weight               priorities
                      no_path_retry           5
                  }
        multipath {
                      wwid                    14f504e46494c45527a4e387762672d715632712d68396951
                      alias                   asm-disk-01
                      path_grouping_policy    multibus
                      path_checker            readsector0
                      path_selector           "round-robin 0"
                      failback                manual
                      rr_weight               priorities
                      no_path_retry           5
                  }
        multipath {
                      wwid                    14f504e46494c45526a4c5a6b58632d395a56312d42527652
                      alias                   asm-disk-02
                      path_grouping_policy    multibus
                      path_checker            readsector0
                      path_selector           "round-robin 0"
                      failback                manual
                      rr_weight               priorities
                      no_path_retry           5
                  }
        multipath {
                      wwid                    14f504e46494c45526c36694345372d524761642d32736c77
                      alias                   asm-disk-03
                      path_grouping_policy    multibus
                      path_checker            readsector0
                      path_selector           "round-robin 0"
                      failback                manual
                      rr_weight               priorities
                      no_path_retry           5
                  }
         }




10。 重启multipath服务