backup image too bigger than the backuped LXC

fruchtzwerg

Member
Apr 3, 2023
44
2
13
I regulary backuped all my LXC's. Now I want to restore a single LXC from a backup, but it failed.
After inspection I discovered, that the volume of the LXC had a size of 8GB. But the backup's size is 10,2GB. So while restoring at some point there is not space left for the new created LXC an the backup fails and no LXC is restored.

Actually I can't explain why the backup is oversized. Could it be possible that Proxmox secretly increased the storage over time? Because there is a growing database inside the LXC and I forgot to increase the container. But I newer received a warning that there is limited storage.

Is it possible to backup the LXC an increase the storage immediately before it is full of the backup?
 
Thanks for the hint.
It seems that large sparse files course the problem. How can I detect those in the backup and how to handle it?
 
You're welcome
As Fiona mentioned in the post:
The real solution is to improve handling of sparse files. Feel free to open a feature request on our bug tracker.

A workaround is to remove or re-create the problematic file(s) as non-sparse. To find it, you can try to use:

find /main-pool/lxc-disks/subvol-502-disk-0 -type f -printf "%S\t%p\n" | awk '$1 < 0.5 {print}'

with the first column being the ratio of used space.

Example from my machine:

Code:
root@pve701 ~ # find /myzpool/subvol-128-disk-0/ -type f -printf "%S\t%p\n" | awk '$1 < 0.5 {print}'
0.257143        /myzpool/subvol-128-disk-0/lib/apk/db/scripts.tar
0.484555        /myzpool/subvol-128-disk-0/lib/libeinfo.so.1
0.474695        /myzpool/subvol-128-disk-0/lib/rc/bin/kill_all
0.331034        /myzpool/subvol-128-disk-0/lib/rc/bin/shell_var
0.325792        /myzpool/subvol-128-disk-0/lib/rc/sbin/rc-abort
0.482509        /myzpool/subvol-128-disk-0/lib/rc/sbin/swclock
0.327645        /myzpool/subvol-128-disk-0/bin/bbsuid
0.485732        /myzpool/subvol-128-disk-0/usr/bin/iconv
0.446606        /myzpool/subvol-128-disk-0/usr/bin/getconf
0.4828  /myzpool/subvol-128-disk-0/usr/lib/engines-1.1/padlock.so
0.332564        /myzpool/subvol-128-disk-0/usr/lib/engines-1.1/capi.so
0.329331        /myzpool/subvol-128-disk-0/sbin/mkmntdirs
4.76837e-09     /myzpool/subvol-128-disk-0/root/sparse
root@pve701 ~ # ls -lh /myzpool/subvol-128-disk-0/root/sparse
-rw-r--r-- 1 100000 100000 100G Jan  5 09:09 /myzpool/subvol-128-disk-0/root/sparse

root@pve701 ~ # du -h /myzpool/subvol-128-disk-0/root/sparse
512     /myzpool/subvol-128-disk-0/root/sparse