I had a space issue after the last snapshot and upgrade but I increased the LVM volume quota and perform the required resize2fs on the LVM volume. I fear that the storage group might not have seen the size upgrade. But I have not found so far how to fix this as well.
admin@host:~$ lxc storage info Meddd
info:
description: ""
driver: btrfs
name: Meddd
space used: 39.74GiB
total space: 41.00GiB
used by:
instances:
- gooo
- gooo
profiles:
- default
I added 50GB to the LVM Volume so I was expeting the total space to be close to 100GB.
Problem is that it is a btrfs file img. There seem to be no link between the BTRFS file sizes on the LVM extfs partition (real or theorical) and the btrfs device size from that same file once mounted. I have tried a fallocate for the img file but it does not sync with the btrfs device size. So quite logically any attempt such as “btrfs filesystem resize max” fail.
Surprisingly most of documentation on btrfs resizing only applies to a regular FS not a file img FS.
LVM grown and image file grown thru but resize not working
admin@host:~# sudo btrfs filesystem resize max /var/snap/lxd/common/lxd/storage-pools/Medd/
ERROR: not a btrfs filesystem: /var/snap/lxd/common/lxd/storage-pools/Medd/
Which is quite logical as this is not any mounted point.
I tried also adding the sudo losetup -c <loop_device>
with the same result.
This would mean a split storage from my understanding … I definitivelly simply want to expand my storage capacity and found out to be stuck on such a simple and basic thing.
Ok, some long hours of deep diving, I got lxc back online …
First I add to resize the LVM and ensure the EXTFS was in sync with the change.
But at that point you will have to go for the following :
Allocate the new maximum file size (here 60GB): fallocate -l 60G /var/snap/lxd/common/lxd/disks/Medd.img
Fetch the target loop using : losetup -j /var/snap/lxd/common/lxd/disks/Medd.img
From that loop given (say here loop26) ensure its target is up and resizes : sudo losetup -c /dev/loop26
Update the device loop target to the max size sudo btrfs filesystem resize max /var/snap/lxd/common/mntns/var/snap/lxd/common/lxd/storage-pools/Medd/
Force the update at the lxc level : lxc storage set Medd size=60GB
Here are a couple of things that would be nice to improve in lxc
Log any file capacity outage in the lxc log
Give more details (verbose mode) on the reason it is failing to start a VM
Confirm that there is a capacity outage if start is failing
Provide a way to directly resize the underlying structure all-in-one. LXC knows where the .img is and its configuration. If such a resize is not possible it should advice the way forward
We have an item on our roadmap for this cycle (I think) to support resizing image backed storage pools via the pool’s size setting.
As for improving error messages, I suspect that has already been done, as you’re running a pretty old version of LXD now (the 4.0 LTS series is only supported for security fixes now), and we’ve been moving to using error wrapping a lot more over the last few years to include more information in error messages.
I would strongly recommend you upgrade to the 5.0 LTS series (5.0/stable snap channel).