ipic Guru
Joined: 29 Dec 2003 Posts: 400 Location: UK
|
Posted: Sun Jun 21, 2020 5:12 pm Post subject: [SOLVED] libvirt lxc: lvremove fails: .. filesystem in use. |
|
|
Background:
Create a Logical volume (lvcreate) and format a file system on it.
Mount the file system, and use it as a passthrough, mounted file system when creating a libvirt LXC domain.
Example XML: Code: | <filesystem type="mount" accessmode="passthrough">
<source dir="/var/lib/lxc/lxc-webtest/rootfs"/>
<target dir="/"/>
</filesystem> | Start domain, play around, stop domain.
Problem
When done playing, you do the following:
Stop the domain
Destroy the domain
Unmount the logical volume
At this point, if you try and remove your logical volume, lvremove may report that Code: | Logical volume <your-lvm-name-here> contains a filesystem in use. |
You look in all the usual places (mount, findmnt, fuser, dmsetup, udevadm), but can't find anything that is causing the open count to be 1.
Optionally, you begin to doubt your sanity.
Solution
Stop ALL libvirt_lxc domains that are running.
If there was no other reason for the open count being greater than 1, it should now drop to zero.
Starting the other libvirt_lxc domains again does not cause it to become used again either.
Of course, a reboot will have the same effect.
PS: This seemed the most appropriate place to post this - apologies if its in the wrong sub forum.
PPS: Really posting it so that I can find the solution again when I forget next time |
|