If I have relatively small / filesystem, but large /opt partition and I want to export a container to /opt, and said container is larger than free space on / then lxc export fails:
Error: Create backup: Backup storage: Failed to run: tar -cf /var/snap/lxd/common/lxd/backups/main/backup0 --xattrs -C /var/snap/lxd/common/lxd/backups/lxd_backup_583972121 --transform s,^./,backup/, .: tar: /var/snap/lxd/common/lxd/backups/main/backup0: Wrote only 2048 of 10240 bytes tar: Error is not recoverable: exiting now
Then the machine is left in broken state: disk is full, lxc list is unresponsive, etc. I have to go to /var/snap/lxd/common/lxd/backups and erase everything there, then I have to reboot the machine, snap restart lxd does not help.
I tried to avoid this problem symlinking backup directory, making /opt/backups and pointing /var/snap/lxd/common/lxd/backups to /opt/backups. Does not work:
Error: Create backup: Backup storage: stat /var/snap/lxd/common/lxd/backups: no such file or directory
So, it seems that I can’t avoid dumping container to root filesystem first. Is it possible to change this behavior to export containers even if root filesystem is smaller than largest container? Leaving a lot of rarely used space in root fs does not make sense when SSDs are involved… what about an option --backup-tmpdir or something like that?