kpartx: cannot unmount disk after mappings have been deleted
6
votes
1
answer
1997
views
I cannot unmount a partition on which I created and then deleted mappings with
kpartx
:
# mount /dev/sdb1 usb/
# cd usb/
# kpartx -a -p sda -r -s -v sda.img
add map loop0sda1 (254:5): 0 16777216 linear 7:0 2048
add map loop0sda2 (254:6): 0 16777216 linear 7:0 16779264
add map loop0sda3 (254:7): 0 440401920 linear 7:0 33556480
add map loop0sda4 (254:8): 0 26159792 linear 7:0 473958400
# kpartx -dv /dev/loop0
del devmap : loop0sda4
del devmap : loop0sda3
del devmap : loop0sda2
del devmap : loop0sda1
# cd ..
#umount usb/
target is busy.
as far as i can tell, the command kpartx -dv /dev/loop0
properly deleted the mappings, as I can see they have disappeared from /dev/mapper/
. But still I cannot unmount the disk, because it reports: target is busy.
lsof
shows no files open from that disk:
# lsof +D
Why cannot i unmout the disk after all mappings have been freed up ?
Asked by Martin Vegter
(598 rep)
Aug 21, 2022, 03:39 PM
Last activity: Aug 23, 2022, 05:15 PM
Last activity: Aug 23, 2022, 05:15 PM