I probably misconfigured something …
I want to set a disk size for the root (/) device.
But in the CT, I get the full host device size, /dev/md3, instead of a 100GB device :
-> lxc exec test – df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/md3 407G 298M 405G 1% /
Here is the default profile:
-> lxc profile show default
config: {}
description: Default LXD profile
devices:
root:
path: /
pool: default
size: 100GB
type: disk
name: default
used_by:
/1.0/containers/test
-> lxc storage list
±--------±------------±-------±-------±--------+
| NAME | DESCRIPTION | DRIVER | SOURCE | USED BY |
±--------±------------±-------±-------±--------+
| default | | btrfs | /btrfs | 3 |
±--------±------------±-------±-------±--------+
-> mount | grep btrfs
/dev/md3 on /btrfs type btrfs (rw,relatime,ssd,space_cache,subvolid=5,subvol=/)
I found that a solution can be creating a btrfs subvolume manually, applying a quota on it, and then adding the device to the CT.
For those we are interested:
btrfs subvolume create /btrfs/data
btrfs qgroup limit 42G /btrfs/data
lxc config device add test default disk source=/btrfs/data path=/data
With LXD 2.16 you should also be able to use “lxc storage volume create POOL-NAME VOLUME-NAME size=42GB” and then use “lxc storage volume attach POOL-NAME VOLUME-NAME test /data” to attach it to your container.