multipath设备删除失败处理思路(mapinuse)
问题: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]决议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:
1、A filesystem exists on the multipath device and is currently mounted.
Unmount the filesystem and if it exists in /etc/fstab, remove it.
2、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).
3、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.
4、Once all holders of the device have been removed, the multipath device should be flushed with "multipath -f ".
根源The multipath device was held open by at least one process or subsystem.
诊断步骤 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