1 安装multipath
[root@jem-r1 ~]# rpm -qa | grep device-mapper
若没有则执行以下命令安装: yum install -y device-mapper*
2 生成配置文件
mpathconf --enable --with_multipathd y
查看scsi_id
[root@jem-r1 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdb 36000c29f7e6ca7c54bd3ad4d2a2b8939 [root@jem-r1 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdc 36000c2970b50cdffdc8e547c8a87938d [root@jem-r1 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdd 36000c292f6145f1679dcb64d20c7499e [root@jem-r1 ~]# /usr/lib/udev/scsi_id -g -u /dev/sde 36000c29c6f447f602411b8adabfe82a9 [root@jem-r1 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdf 36000c29937fecda3c66ce8a02e9a9d9d [root@jem-r1 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdg 36000c29541e4d4e620c8326c45b51dd4
[root@jem-r1 ~]# multipath -v3
配置multipath,wwid 的值为上面获取的 scsi_id,alias 可自定义, 这里配置 3 块 OCR 盘,2块DATA盘,一块 ARCH 盘。 cp /etc/multipath.conf /etc/multipath.conf.bak 初始化配置文件中有以下内容: defaults { user_friendly_names yes find_multipaths yes } blacklist { } 如下需要在 blacklist 添加一行 devnode 信息,删除原有的 blacklist
cat <<EOF>> /etc/multipath.conf blacklist { devnode "^sda" } multipaths { multipath { wwid "36000c29f7e6ca7c54bd3ad4d2a2b8939" alias asm_ocr01 } multipath { wwid "36000c2970b50cdffdc8e547c8a87938d" alias asm_ocr02 } multipath { wwid "36000c292f6145f1679dcb64d20c7499e" alias asm_ocr03 } multipath { wwid "36000c29c6f447f602411b8adabfe82a9" alias asm_data01 } multipath { wwid "36000c29937fecda3c66ce8a02e9a9d9d" alias asm_data02 } multipath { wwid "36000c29541e4d4e620c8326c45b51dd4" alias asm_arch01 } } EOF
3 激活multipath多路径
multipath -F multipath -v2
multipath -ll
4 查看状态
systemctl status multipathd.service
5 开机自启动服务
systemctl enable multipathd.service [root@jem-r1 ~]# multipath -v3 | grep 3600 [root@jem-r1 ~]# mpathconf