First I installed Debian 13 with Incus 7.0.1 (backports) in a single Ext4 partition for whole OS. I enabled “prjquota” and succeeded on setting containers’ device root size.
After this, I created a separate BTRFS partition and moved /var to it, so all Incus data (with VPS, VM, etc.) is there now. The move was done from an external session (Debian 13 Live) by only copying files: cp -a /media/user/rootvolume/var/* /media/user/var/
Once rebooted into static media (Debian+Incus), I see containers have devices:root:size set but this setting has no effect. Inside each container whole host partition space is seen.
From host I see:
$ sudo btrfs qgroup show -r /var
Qgroupid Referenced Exclusive Max referenced Path
0/5 987.34GiB 987.34GiB none
What should I do to apply storage quotas to containers again?
hmm, I’d have expected that enabling quotas on btrfs and then re-applying your root size limits would populate things. Though I don’t remember btrfs quotas being reflected in df or similar in the container, so that part may be normal.
Ah, so yeah, if you’re using the dir driver on top of btrfs, then you get the worse of both worlds
Basically you don’t get the btrfs subvolume based stuff, so still duplicate a lot of data AND you don’t get quotas at all because you don’t have project quotas and aren’t using the driver that knows how to do qgroups.
Then you mean for btrfs I also need to run tune2fs -O project -Q prjquota to this volume? Or I need to create subvolumes? Or this can be done by running incus admin init wizard again?
Is it the same to get deduplication/CoW feature?
Documentation is a bit confusing about dir/btrfs; If BTRFS driver means not DIR, this should be clear, and then mention DIR driver has only sense on top of Ext3/Ext4.
dir works on any filesystem and therefore supports almost no features. You can run it on ext3/ext4, you can run it on vfat, on xfs or on top of btrfs or ZFS. It will basically always work, just equally as bad everywhere.
btrfs is what you want when you want to run on btrfs (as the name kinda implies) and it therefore uses btrfs features like subvolumes, quota groups, send/receive, compression, …
tune2fs is the ext3/ext4 configuration tool, so that cannot do anything useful on a btrfs filesystem.
I suggest for documentation to note that neither “DIR on btrfs” nor “DIR on zfs” are the same as “direct btrfs” or “direct zfs”, and that there is no “direct ext4” without DIR.
This could avoid a mistake as mine.
What can I do to fix current situation? What does Incus need from my “DIR on btrfs” to convert to “direct btrfs”?
Define a new storage pool with incus storage create, then use incus move and incus storage volume move to move things one by one between the two pools.
(I had to set more room to fit all stuff into new storage pool):
$ incus storage set local-btrfs size=1TiB --target=$(hostname)
But Oh surprise! now all containers have 1TiB of disk quota and following has no effect:
$ incus config device set MyContainerName root size=50GiB $ incus storage volume set local-btrfs container/MyContainerName size=50GiB Error: Volume "size" property is not valid for volume type
$ df -hT /var
Filesystem Type Size Used Avail Use% Mounted on
/dev/nvme0n1p4 btrfs 1.8T 976G 827G 55% /var
$ for ccc in $(incus list -c n -f compact,noheader) ; do incus exec $ccc -- df -hT / ; done
Filesystem Type Size Used Avail Use% Mounted on
/dev/loop0 btrfs 1.0T 68G 957G 7% /
Filesystem Type Size Used Avail Use% Mounted on
/dev/loop0 btrfs 1.0T 68G 957G 7% /
Filesystem Type Size Used Avail Use% Mounted on
/dev/loop0 btrfs 1.0T 68G 957G 7% /
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/sda2_crypt btrfs 50G 39G 9.6G 81% /
Filesystem Type Size Used Avail Use% Mounted on
/dev/loop0 btrfs 1.0T 68G 957G 7% /
Filesystem Type Size Used Avail Use% Mounted on
/dev/loop0 btrfs 1.0T 68G 957G 7% /
Filesystem Type Size Used Avail Use% Mounted on
/dev/loop0 btrfs 1.0T 68G 957G 7% /
Filesystem Type Size Used Avail Use% Mounted on
/dev/loop0 btrfs 1.0T 68G 957G 7% /
Filesystem Type Size Used Avail Use% Mounted on
/dev/loop0 btrfs 1.0T 68G 957G 7% /
Filesystem Type Size Used Avail Use% Mounted on
/dev/loop0 btrfs 1.0T 68G 957G 7% /
Okay, I’ve enabled quotas, then I’ve created a new storage pool and moved all containers into it but, once I reboot Incus host, no effect on per-container quota:
$ sudo btrfs quota enable /var
$ incus storage create base-btrfs btrfs
$ incus storage set base-btrfs size=1TiB --target=$(hostname)
$ for ccc in $(incus list -c n -f compact,noheader) ; do incus stop $ccc --force ; incus move $ccc --storage base-btrfs ; incus start $ccc ; done
$ incus storage volume move local-btrfs/debian-13.6.0-amd64-DVD-1.iso base-btrfs/debian-13.6.0-amd64-DVD-1.iso
Storage volume moved successfully!
$ sudo reboot
$ incus exec MyContainerName -- df -hT /
Filesystem Type Size Used Avail Use% Mounted on
/dev/loop0 btrfs 1.0T 62G 962G 7% /
$ incus config device set MyContainerName root size=50GiB
$ incus exec MyContainerName -- df -hT /
Filesystem Type Size Used Avail Use% Mounted on
/dev/loop0 btrfs 1.0T 62G 962G 7% /
$ sudo btrfs qgroup show -r /var
Qgroupid Referenced Exclusive Max referenced Path
-------- ---------- --------- -------------- ----
0/5 966.86GiB 966.86GiB none <toplevel>
What else do I should to do to see if Linux kernel is reporting or not qgroups in disk usage? cmdline? mounts?
$ btrfs quota status /var
Quotas on /var:
Enabled: yes
Mode: qgroup (full accounting)
Inconsistent: no
Override limits: no
Drop subtree threshold: 3
Total count: 1
Level 0: 1