The easiest way to shrink the size of a Proxmox container’s root volume is to backup the container and restore it to a new container with the updated volume size. The following sequence of operations will do this – please be careful and make sure to take full backups as some of these steps will destroy the container/configuration. Additionally, make sure that your restore volume size is at least as large as the amount of data in the container.
First, take a full backup of the container (preferably after stopping the container):
vzdump <container-id> --storage <backup-storage>
After this step, your backup will be stored in some path under backup-storage and look similar to /path/to/backup/vzdump-lxc-<container-id>-xxxxx.tar.zst
or something along those lines. You will need this exact file for the restore step.
Next, make a backup copy of the original container configuration in case you run into issues:
cp /etc/pve/lxc/<container-id>.conf /path/to/backup
After this, destroy the original container (you will restore to this container in the next step):
pct destroy <container-id>
Finally, restore from the backup to the container id:
pct restore <container-id> /path/to/backup/vzdump-lxc-<container-id>-xxxxx.tar.zst --storage <storage> --rootfs <lvm>:<new root volume size in GB>