Resize LVM container volume

From what I understand, and please do correct me if I’m wrong, it is currently not possible to resize a LVM based container using the lxd/lxc commands, it has to be done using lv* tools. The same goes for taking snapshots.

I noticed, however, that even after the resize, lxc info will still show the “old” size of the container.

  1. Are there any potential adverse consequences to the false size in lxc info? E.g. when using other lxc commands such as lxc export?
  2. Which other steps, other than using the lv* tools, should be taken when the filesystem of a container has been resized?

About extending storage pools (you don’t actually resize a container, except if you have one container = one storage pool) you are correct lxd don’t manage this ATM.

if by ‘lxc info’ you mean
lxc storage show <storage pool name>
this is a lxd limitation, the size always remains what it was at the storage creation. There is no problems with this not uptodate information, lncluding with lxc export

if you mean
lxc storage info <storage pool name>
this is NOT correct, the size SHOULD change.
If it does not, you have done something wrong.

about shapshots: I think that you should definitely NOT use LVM snapshots.

When you have extended a LVM partition and successfully extended the file system, the storage should be usable by LXD immediately, a running container will even see the new size without restarting it.
Decreasing size should also be possible but I never tested it, since it’s rarely used it’s less well known.
As always a backup is good, especially before reducing size.

I’m not sure I follow when you say “you don’t actually resize a container”.

In my setup I have one single storage pool for multiple containers. It’s an LVM thinpool. The default size of each container, that is of each volume inside the thinpool is 10GB. If a single container needs more space than that, I have to extend the volume. Right now, this doesn’t seem possible using lxd so I have to use lvextend. And in a second step I still have to resize the container FS manually using resize2fs.

And never mind “lxc info”, that’s a mistake, I did in fact mean lxc storage volume show <poolname> container/<containername>. Under config:, it shows a volume size of 10GB when I increased the volume to 100GB. If I understand you correctly, that’s not something I have to worry about.

Speaking about the pool size, why is lxc storage info <storage pool> showing the size of the VG and not of the LV thinpool? In my case, the VG is 500GB and the thinpool is 150GB, and lxc storage info <storage pool> shows a size of 500GB. I’m not sure this really matters but it’s not the correct information.

duh, I missed that you use thin provisioning. I decided early to not touch this stuff if I could avoid it and so far I don’t miss it, so I don’t know about its possible problems. Seems wrong that the VG size is displayed, though.

Just note that thin provisioning is what the LXD documentation recommends when using LVM. It’s even set as a default.

See section LVM on https://lxd.readthedocs.io/en/latest/storage/

By default, all LVM storage pools use an LVM thinpool in which logical volumes for all LXD storage entities (images, containers, etc.) are created. […] [Regular volumes] should only be chosen if the use-case renders it necessary.