How to get rid of or remove the multipath device without rebooting the server, rescanning the scsi bus, or restarting multipathd (kpartx 에 관련된 내용)
목차
문제
- 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]
환경
- Red Hat Enterprise Linux 5, 6
- Device mapper multipath
- SAN connected storage
해결
- 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).
- Use "
- 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.
- A filesystem exists on the multipath device and is currently mounted.
-
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
* 실제 필드에서 작업하면서 느끼는 것은.. 그렇다라도 스토리지 변경작업은 서버 리부팅을 권장한다.
리부팅 없이 multipath 삭제.