Problem/Justification
I noticed that the LXC system container created by Incus seems to be placed in the .ix-virt/containers directory, which makes it impossible for users to access the container storage path and perform snapshot operations through the Dataset Page. Furthermore, LXC VMs created with Incus completely lose the protection of snapshots.
Impact
Previously, when using the KVM backend, users could only store virtual machine data through zfs zvol. Sincezfs zvol does not allow shrinking, this resulted in a lot of space waste.
Incus provides two mature ways to implement snapshots, one based on zfs dataset and the other based on zfs zvol, but TrueNAS does not currently provide these features. Please refer to:
These are all direct functions provided by Incus, which means they can be implemented at a very low development cost.
In addition, Incus in 25.04 RC.1 provides an instance-based mounting function, which does not seem to be implemented based on Incus Storage Drivers, but is similar to Docker’s path mapping function, and does not allow mounting the root directory.
User Story
There are two ways to achieve this:
Use a method similar to ixVolumes to manage snapshots of Incus LXC containers through a separate WebUI, which requires more development and is not flexible. At least I prefer to manage the Dataset after mapping the path through the Host Path, although this may create some security risks.
Add an option to the instance creation page to mount the root path of the LXC container to the zfs dataset or zfs zvol function, and then manage it manually through the Dataset Page.
If we’re talking about a thinly allocated ZVOL not being able to be TRIMmed by a VM, it actually has supported that for a long time now. It was TrueNAS that was lagging behind, but even they added that support a while back.
Maybe I am misinterpreting what you’re saying, but if you create a VM in e.g. Truenas Scale Electric Eel with a thinly allocated ZVOL and install Linux in there, enable TRIM (or discard, in Linux parlance) the actual space used by the ZVOL will shrink and grow just fine with the data contained in it.
Not saying this feature shouldn’t be added… it should
But I’m just pointing out that you can currently setup a snapshot schedule and expiry directly using the incus command in the CLI
You can configure an instance to automatically create snapshots at specific times (at most once every minute). To do so, set the snapshots.schedule instance option.
I might be wrong, but Incus only include into the snapshots the root volume, this is the one managed by Incus.
In addition, as mentioned in the logging banner it is strongly advised to make changes only through the TrueNAS WebUI or API, because the changes you do using shell/console might be overwritten by the future upgrades or potentially make the system unstable.
So yeah, probably will stick with custom scripts to address that and wait this to be fixed in the WebUI.