How to Shrink Dir Based VM?

I have a VM built from ubuntu 20.04 LTS amd64 (release) running on the dir driver and I’d like to shrink the VM’s root volume, but I can’t seem to find a way to do so.

For VMs, LXD can only grow them as we have no idea what the partitioning may be inside of the VM nor can we safely go look or alter it.

You can cause an instance to be smaller from the start by setting the root disk size in a profile and using that profile at creation time. Though note that it won’t let you shrink to something smaller than the image itself (usually 5GiB).