Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] libvirt lxc: lvremove fails: .. filesystem in use.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
ipic
Guru
Guru


Joined: 29 Dec 2003
Posts: 400
Location: UK

PostPosted: Sun Jun 21, 2020 5:12 pm    Post subject: [SOLVED] libvirt lxc: lvremove fails: .. filesystem in use. Reply with quote

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
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum