Forcibly remove a stuck dm mapping

From HeepyWiki
Revision as of 08:15, 26 May 2014 by Morris (talk | contribs) (Created page with "This happens sometimes when you use something like kpartx to generate mappings for a lvm volume, so you can mount its partitions. Once you unmount, kpartx -d is supposed to re...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This happens sometimes when you use something like kpartx to generate mappings for a lvm volume, so you can mount its partitions. Once you unmount, kpartx -d is supposed to remove all those mappings so that the lvm volume is free to be removed, but sometimes they get stuck, for instances when a snapshot or copy-on-write volume exists. You can forcibly remove the device mapper entry but it's probably dangerous, at least if you want to keep the volume. But usually you're trying to do this in order to be able to remove the volume, so whatever.

dmsetup -v remove --force /dev/mapper/vg00-debsnap1
lvremove /dev/vg00/debsnap