Remove devices left after kpartx

In case you’ve used kpartx -a on a disk image to mount partitions from it, and then deleted that image (so you cannot kpartx -d anymore, as you would normally do), use this:

dmsetup delete /dev/dm-X

to remove each /dev/dm-X device left over. Use losetup -D to remove the /dev/loopX device left over.

1 thought on “Remove devices left after kpartx

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s