device-mapper: remove ioctl failed: Device or resource busy

Problem in IMS services?

I have jumped into this strange problem when I tried to remove a logical volume.

Things would have been easy if I had used lsof command

The logical volume was named /dev/lvols/ubuntu64

At first

[bash]

$lvremove /dev/lvols/ubuntu64

[/bash]

This command couldn’t remove the logical volume the next command I tried was

[bash]

root@manager-desktop:~# dmsetup remove –force /dev/lvols/ubuntu64
device-mapper: remove ioctl failed: Device or resource busy
Command failed

[/bash]

So some process is using this logical volume and to find the process id the next command was

[bash]

root@manager-desktop:~# lsof /dev/lvols/ubuntu64
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
vblade  31213 root    3u   BLK  252,4      0t0 115749 /dev/lvols/../mapper/lvols-ubuntu64

[/bash]
[bash]

root@manager-desktop:~# kill -9 31213

[/bash]

Now issued the commands

[bash]

root@manager-desktop:~# dmsetup remove –force /dev/lvols/ubuntu64

root@manager-desktop:~# lvremove /dev/lvols/ubuntu64
Logical volume “ubuntu64” successfully removed

[/bash]

Voila.. simple fix and point to remember is never forget lsof command 🙂

solutions available on IMS services support services and IT Infrastructure Management

reference ; Wikipedia

2 comments

  1. Thanks! This was a HUGE help! I had tgt linux iscsi running ontop of my lv but forgot about it and was pulling hair out until lsof technique you posted reminded me to shut off tgt then it all fell into place.

Leave a Reply

Your email address will not be published. Required fields are marked *