The multipathd -k command is an interactive interface to the multipathd daemon. Entering this command brings up an interactive multipath console. After entering this command, you can enter help to get a list of available commands, you can enter a interactive command, or you can enter CTRL-D to quit.
The multipathd interactive console can be used to troubleshoot problems you may be having with your system.
The Problem
Using multipathd -k interface you can add/remove a particular path from the multipath map. Attempting to remove a device map fails with the following error:
# multipath -f mpath1 Jan 1 09:00:00 | mpath1: map in use
# dmsetup remove -f mpath1 device-mapper: remove ioctl on mpath1 failed: Device or resource busy
The Solution
The map in use message denotes that the device map is still in use by a specific process or storage layer e.g. LVM, RAID, etc.
1. Use the mount command to verify the device is not still mounted. For example:
# mount
2. Use the dmsetup command to identify the current device/map mapping:
# dmsetup table | grep [DEVICE NAME]
Ensure no other mapped device are using the device.
3. Identify the kernel device name (dm-X) in /dev/mapper/:
# ls -l /dev/mapper | grep [DEVICE NAME] [DEVICE NAME] -> dm-X
4. Use the lsof command to determine which process may be using the device.
# lsof | grep dm-x # lsof | grep [DEVICE NAME]
If the output above denotes any process(es) using the device, shutdown the application or program. Should that fail, consider killing the process.
# kill -9 [PID]
5. If the issue persists still, use the below command to disable queueing for the problematic multipath device.
# multipathd disablequeueing map mpath1