Abnormal backup size

I did a backup/export with:

lxc export toots toots.tar --compression=none --instance-only --optimized-storage

I got a 17G file:

# ls -lha /mnt/storagebox/lxd-backups/toots.tar 
-rw-rw---- 1 root root 17G Sep 12 07:38 /mnt/storagebox/lxd-backups/toots.tar

If I look with zfs list, used space is 9.50G with snapshots:

# zfs list local/containers/toots
NAME                     USED  AVAIL     REFER  MOUNTPOINT
local/containers/toots  9.50G  42.7G     6.72G  /var/snap/lxd/common/lxd/storage-pools/local/containers/toots

Real size on container is 6.80G:

# lxc exec toots -- df -h /
Filesystem              Size  Used Avail Use% Mounted on
local/containers/toots   50G  6.8G   43G  14% /

That’s a bit strange… Is --instance-only really working?
Even if backup/container.bin in the tar file contains snapshots the size seems really wrong.
Maybe --optimized-storage is the culprit? I use ZFS for containers, but my backup storage is a CIFS volume.
Details on the image:

# file backup/container.bin 
backup/container.bin: ZFS shapshot (little-endian machine), version 17, type: ZFS, destination GUID: E6 8A AC 92 EC 39 D3 09, name: 'local/containers/toots@backup-0d19a50d-7733-4e0b-bdd8-ba19c68a39f4'

Any ideas?

Is that an uncompressed tar file? If so, compress it to see if it matches the actual sizes.

The issue with tar files is that if you tar a big directory tree with a huge number of small files, then this generates a very large .tar. It is a legacy situation going back several decades.

There is only two files in the .tar file so it’s not related to “huge number of small files”.

Do you have compression enable in zfs ?

1 Like

Definitely a bit surprising as you would expect a disk usage similar to the reference one.

LXD doesn’t really do much magic there, the binary file is just a written down version of a zfs send. So as suggested, it may be related to compression if your on-disk pool is compressed?

1 Like

Indeed compression is on! Totally forgot that.

# zfs get compression
NAME                                                                                    PROPERTY     VALUE     SOURCE
local                                                                                   compression  on        local
local/containers                                                                        compression  on        inherited from local

Thanks and sorry for the noise.