在系统中经常自动发现了多路径设备:

[root@master ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sda               8:0    0  400G  0 disk
├─sda1            8:1    0    1G  0 part  /boot
└─sda2            8:2    0   79G  0 part
  ├─centos-root 253:0    0 47.8G  0 lvm   /
  ├─centos-swap 253:1    0  7.9G  0 lvm
  └─centos-home 253:2    0 23.3G  0 lvm   /home
sdb               8:16   0  100G  0 disk
sdc               8:32   0  100G  0 disk
sr0              11:0    1 1024M  0 rom
nvme0n1         259:0    0    8T  0 disk
└─mpatha        253:3    0    8T  0 mpath
[root@master ~]#

每次自动出现,当想使用nvme0n1这个设备必须通过下面的命令

multipath -F
multipath -f mpatha

移除掉,才可以继续使用. 但是当下次重启后,这个多路径设备又自动出现了.多路径有两个配置

/etc/multipath.conf
/etc/multipath/bindings

把bindings中的绑定删除掉

[root@master ~]# cat /etc/multipath/bindings
# Multipath bindings, Version : 1.0
# NOTE: this file is automatically maintained by the multipath program.
# You should not need to edit this file in normal circumstances.
#
# Format:
# alias wwid
#
mpatha uuid.00000000-0000-0000-0000-00005565f417
mpathb uuid.00000000-0000-0000-0000-00005826d2ce
mpathc uuid.00000000-0000-0000-0000-00005ce7cf79
mpathd uuid.00000000-0000-0000-0000-00002fcd27fa
mpathe uuid.00000000-0000-0000-0000-0000228e0123

当系统重启,或网络块设备自动重连后,又会自动生成.而且通过

dmsetup remove -f mpatha

也不能移除.其实就是从块设备中读取数据的时候,读取到了一部分multipath的元数据信息,而且当前系统中已经安装了多路径的软件包,然后自动把多路径设备给构建出来了.通过下面的命令禁用multipath服务

systemctl stop multipathd
systemctl disable multipathd
--------------------------
# service multipathd stop
# chkconfig --list | grep multipathd
# chkconfig multipathd off
# chkconfig --list | grep multipathd
multipathd      0:off   1:off   2:off   3:off   4:off   5:off   6:off

或者是直接把multipath的rpm包直接给移除掉.

# rpm -qa |grep multipath
device-mapper-multipath-0.4.9-93.el6.x86_64
device-mapper-multipath-libs-0.4.9-93.el6.x86_64
# yum remove device-mapper-multipath
# cp /boot/initramfs-[kernel version].img /boot/initramfs-[kernel version].img.BAK
# dracut -v -f --omit dm_multipath initramfs-[kernel version].img [kernel version]