On an EXT4 hard drive, is there a better way to limit the amount of space LXC occupies on the hard drive?
My system is Debian 12 with an EXT4 filesystem. I’m using Incus to create LXC containers, and the storage pool is configured with the dir backend. I’ve been trying to limit the disk usage of my LXC containers, but the limits are not taking effect, and the disk usage still exceeds the specified size.
I searched on Google and found suggestions that for an EXT4 filesystem, I must enable quotas in /etc/fstab and also run tune2fs -O project -Q prjquota /dev/sda2 on the partition while it is unmounted.
This seems like a very troublesome process. It reminds me that two years ago, I attempted to use prjquota with LXC. However, many VPS providers do not offer a rescue mode, making it difficult to unmount the root partition to perform such operations. This makes it an impractical solution in many cases. Back then, I ended up using a loop device and a mount to enforce disk limits.
on an EXT4 filesystem, is there a better, more modern method to limit the disk usage of an LXC container today?