How to get rid of or remove the multipath device without rebooting the server, rescanning the scsi bus, or restarting multipathd
Updated June 6 2014 at 1:22 PM -
Environment
- Red Hat Enterprise Linux 5, 6
- Device mapper multipath
- SAN connected storage
Issue
- Unable to remove the multipath device after unmapping the LUN from the server.
- Attempting to flush a multipath map with "multipath -f" or "multipath -F" results in "map in use":
# multipath -f mpath7 mpath7: map in use
- The multipath command still shows the multipath device, with path(s) to the unmapped LUN as follows:
# multipath -ll mpath7 mpath7 (36090a01870982994dcb8d4405ed03cbf) dm-7 , [size=4.4T][features=1 queue_if_no_path][hwhandler=0][rw] \_ round-robin 0 [prio=0][enabled] \_ #:#:#:# - #:# [failed][faulty]
Resolution
- Locate any subsystem or process holding the multipath device open. See diagnostic steps for possible tools and techniques.
- For any subsystem or process holding the multipath device open, stop the process, or issue commands to release the multipath device.
- Some examples of possible holders of a multipath device and the commands to release it:
-
- A filesystem exists on the multipath device and is currently mounted.
-
-
- Unmount the filesystem and if it exists in /etc/fstab, remove it.
-
-
- One or more partition mapping(s) still exists on the multipath device.
-
-
- Use "kpartx -d" on the multipath device to remove the device partition mapping(s).
-
-
- The multipath device was used by LVM, and still has device mapper state in the kernel.
-
- Use "lvchange -an" to deactivate any logical volume(s) associated with the multipath device. A list of logical volumes associated with the multipath device may be found by examining the output of "lvs -o +devices".
- If "lvchange -an" fails, the logical volume is only partially removed, or there are blocked processes with I/O outstanding on the device, use "dmsetup remove -f" followed by "dmsetup clear" on the multipath device. See dmsetup man page for full explanation of these commands.
- Once all holders of the device have been removed, the multipath device should be flushed with "multipath -f".
Root Cause
- The multipath device was held open by at least one process or subsystem.
Diagnostic Steps
- Use 'lsof' to attempt to find anyone holding the device open.
- Check 'dmsetup' output for any device mapper maps that depend on the multipath device
- Check the if there is a device for mpath7 in /dev/mapper/mpath7
- Check multipath -v4 -ll
- 红帽企业Linux 5、6
- 设备映射器多路径
- SAN连接的存储
问题
- 从服务器取消映射LUN后无法删除多路径设备。
- 尝试使用“ multipath -f”或“ multipath -F”刷新多路径地图将导致“正在使用地图”:
# multipath -f mpath7 mpath7: map in use
- multipath命令仍然显示多路径设备,其中包含到未映射LUN的路径,如下所示:
# multipath -ll mpath7 mpath7 (36090a01870982994dcb8d4405ed03cbf) dm-7 , [size=4.4T][features=1 queue_if_no_path][hwhandler=0][rw] \_ round-robin 0 [prio=0][enabled] \_ #:#:#:# - #:# [failed][faulty]
解析度
- 找到使多路径设备保持打开状态的所有子系统或过程。请参阅诊断步骤以获取可能的工具和技术。
- 对于使多路径设备保持打开状态的任何子系统或过程,请停止该过程或发出命令以释放多路径设备。
- 多路径设备的可能持有者以及释放它的命令的一些示例:
-
- 多路径设备上存在一个文件系统,并且该文件系统当前已安装。
-
-
- 卸载文件系统,如果它存在于/ etc / fstab中,请将其删除。
-
-
- 多路径设备上仍存在一个或多个分区映射。
-
-
- kpartx -d在多路径设备上使用“ ”删除设备分区映射。
-
-
- LVM使用了多路径设备,但内核中仍具有设备映射器状态。
-
- 使用“ lvchange -an”停用与多路径设备关联的任何逻辑卷。通过检查“ lvs -o +devices”的输出,可以找到与多路径设备关联的逻辑卷的列表。
- 如果“ lvchange -an”失败,则逻辑卷仅被部分删除,或者设备上存在阻塞的进程,且I / O尚未完成,请在多路径设备上使用“ dmsetup remove -f”,然后使用“ ” dmsetup clear。有关这些命令的完整说明,请参见dmsetup手册页。
- 移除设备的所有支架后,应使用“ multipath -f”冲洗多路径设备。
根本原因
- 多路径设备至少由一个进程或子系统保持打开状态。
诊断步骤
- 使用“ lsof”尝试查找使设备保持打开状态的任何人。
- 检查“ dmsetup”输出是否有依赖于多路径设备的任何设备映射器映射
- 检查/ dev / mapper / mpath7中是否有用于mpath7的设备
- 检查多路径-v4 -lls have created while supporting our