"Logical volume in use" -- cannot remove logical volume
I think the main mistake was to execute lsof
/fuser
on the device-file "/dev/xen3-vg/deleteme" and not on the mount-point (e.g.: "/mnt/myDataMount").
(Thats misleading and I also tripped into it: but it's the same, as if you wanted to run lsof
on "/dev/sda3" - that does not work. But you can run lsof
on /mount/somedrive)
The steps to do in short:
- search the "LV path" in the mounts with
mount |grep deleteme
# where "deleteme" stands for the lv-name. this exemplary outputs something like "/my/mountpoint" lsof /my/mountpoint
to find out which process is using it- kill the process (
kill -9 naggingprocess
) or stop the service (service something stop
) - check (2.) again
umount /dev/xen3-vg/deleteme
lvremove /dev/xen3-vg/deleteme
(orlvremove -f
)
Related videos on Youtube
Jonathan Maron
I have been involved in web application conceptualization and development since 1996. I lead a transcontinental and multi-functional team of programmers, graphical artists, authors and search engine optimizers. Our team builds highly usable, multi-lingual, fully localized web applications, which rank well in all search engines for all applicable languages and countries.
Updated on September 18, 2022Comments
-
Jonathan Maron almost 2 years
On a Xen 4.8 hypervisor, running on Debian Stretch, I am trying to remove the logical volume of a domU that is no longer used.
I stopped the domU and successfully removed the logical volume for the swap file.
However, when trying to remove the logical volume of the main disk, I get the error:
Logical volume xen3-vg/vmXX-disk in use.
As I need the disk space on the hypervisor for other domUs, I successfully resized the logical volume to 4 MB.
To make it obvious which logical volume needs to be deleted, I renamed the logical volume to "xen3-vg/deleteme".
Nevertheless:
> lvremove -vf /dev/xen3-vg/deleteme
Returns:
Logical volume xen3-vg/deleteme in use.
On searching, I have tried all the following, but to no avail.
> lvdisplay --- Logical volume --- LV Path /dev/xen3-vg/deleteme LV Name deleteme VG Name xen3-vg LV UUID iL2tB4-4tjc-0dlj-ibBX-nQup-oZsX-g81XXO LV Write Access read/write LV Creation host, time xen3, 2017-01-04 07:16:26 +0100 LV Status available # open 1 LV Size 4.00 MiB Current LE 1 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 254:7 > dmsetup info -c | grep deleteme xen3--vg-deleteme 254 7 L--w 1 1 3 LVM-aAW4aSeLjqJPPWlF1s1WxAgzeXAjWmXiiL2tB44tjc0dljibBXnQupoZsXg81XXO > lvchange -an -v /dev/xen3-vg/deleteme Logical volume xen3-vg/deleteme in use. > lvremove -vf /dev/xen3-vg/deleteme Logical volume xen3-vg/deleteme in use. > umount /dev/xen3-vg/deleteme umount: /dev/xen3-vg/deleteme: not mounted > lsof | grep "254,7" [no output] > lsof | grep deleteme [no output] > fuser /dev/xen3-vg/deleteme [no output]
If someone could offer advice on how to remove xen3-vg/deleteme I would be very happy.
Rebooting the hypervisor is the final option (to be executed out of office hours), but I would prefer not rebooting.
Thank you in advance.
Thank you, Brandon for your suggestion.
Following the instructions at http://naveen161089.blogspot.com/2014/03/forcefully-remove-lvm.html I tried the following:
> dmsetup ls [..] xen3--vg-deleteme (254:7) [..] > dmsetup info -c xen3--vg-deleteme Name Maj Min Stat Open Targ Event UUID xen3--vg-deleteme 254 7 L--w 1 1 3 LVM-aAW4aSeLjqJPPWlF1s1WxAgzeXAjWmXiiL2tB44tjc0dljibBXnQupoZsXg81XXO > dmsetup remove xen3--vg-deleteme device-mapper: remove ioctl on xen3--vg-deleteme failed: Device or resource busy Command failed > lvremove -f /dev/xen3-vg/deleteme Logical volume xen3-vg/deleteme in use.
I already followed the instructions at: Can't remove open logical volume as stated in my original post.
Neither approach solved the problem.
Does anyone have any further suggestions?
-
Brandon Xavier almost 7 yearsThese might be helpful: naveen161089.blogspot.com/2014/03/forcefully-remove-lvm.html (more to the point) or this one serverfault.com/questions/266697/… (more options to try)
-
Jonathan Maron almost 7 yearsBrandon, thanks for your assistance. I updated the original post with the results of your suggestions.
-
Brandon Xavier almost 7 yearsI'm out of suggestions. It's interesting that you could both rename and resize the volume, but not remove it. Please do keep us posted if you find a solution
-
Jonathan Maron almost 7 yearsIndeed, that puzzles me too. When I have the solution, I will update my original post.
-
MrCalvin about 5 yearsA running process is has an "hold" on the device. To find the process use dmsetup and lsof. In my case if was
libvirt-qemu
-
-
CoderGuy123 about 4 yearsThese did not work for me either. Nothing is using this disk. The LUKS encryption broke (boot repair corrupted it), and these logical drives are stuck there in limbo. Really annoying, had to reinstall, and still while booting from another disk I can't get rid of these logical disks. Can't even just deletion the partition!