Linux Containers and LVM (mount /var/lib/lxc)
5 March, 2021 by
Linux Containers and LVM (mount /var/lib/lxc)
Administrator
| No comments yet

This looks very useful! Your enthusiasm for containers can quickly fill that root file system on the host.

One solution is to use the flexibility of LVM or Logical Volume Management to simply expand the host’s root file system. However, wouldn’t it make more sense to create a new file system on top of LVM and mount that as /var/lib/lxc? Then your file system support for container activity is separated from maintaining the host OS.

But let’s take it a step further — why not use LVM to maintain one logical volume per container and mount each of those as subdirectories of /var/lib/lxc? Each volume could be named for the container, or for the project supported by that container, or whatever you want. Storage use for that container is limited to the size of its logical volume.

The very nice thing is that LVM lets you do whatever makes the most sense to you for solving your problem!

Sign in to leave a comment