Export size doubled with snapshot

Hi everyone!

I’ve hit a strange result. Making a snapshot of a LXC instance is doubling the export size. I didn’t expect this on a ZFS system as snapshots usually add an insignificant amount of overhead. I’ve documented my testing procedure below. Due to the nature of the apps running on the container, I don’t mind taking the time to stop to ensure I can get a clean backup. It takes about 7 seconds to stop/snap/start the containers. Stop/export/start takes much longer.

The Questions:
Am I doing something wrong here?
Should I be using a different command to export the snapshot?
Any thoughts on why the size is doubling while the snapshot exists?
Should I use ZFS commands to do the export instead?

System:

  • Incus 6.0.2 on Debian 12.7 up to date.
  • Guest is Debian 12.7

The test process is:

  • Stop the container
  • Export as _stopped
  • Take the snapshot
  • Export as _stopped_snapped
  • Start the container
  • Export as _started_snapped
  • Delete the snapshot
  • Export as _started

The test script:
incus stop wookie.lan:dms
incus export wookie.lan:dms test_backup_stopped.1.gz
incus snapshot create wookie.lan:dms backup
incus export wookie.lan:dms test_backup_stopped_snapped.1.gz
incus start wookie.lan:dms
incus export wookie.lan:dms test_backup_started_snapped.1.gz
incus snapshot delete wookie.lan:dms backup
incus export wookie.lan:dms test_backup_started.1.gz
ls -l test_backup_*.gz

Result:
2.6G test_backup_stopped.1.gz
5.2G test_backup_stopped_snapped.1.gz
5.2G test_backup_started_snapped.1.gz
2.6G test_backup_started.1.gz

Thanks for any insight!
Mike

Try adding the flag --optimized-storage to your incus export command. You can only restore such exports on another ZFS pool though.

Without this flag, you get plain tarballs.