Closed jlec closed 6 years ago
LXD uses the standard Go tar library, there's an issue upstream for support of sparse file. Looks like a fix was first merged in 1.10 (the next Go release) but had to be reverted, hopefully 1.11 will have a working version of this work.
Closing as since we're just using the standard compression library, as soon as this upstream issue is fixed, we'll automatically be handling sparse files correctly.
Thanks @stgraber for the quick triage.
No worries, I was kinda hoping we were shelling out to tar for that part as it'd have made fixing this a bit easier, but no, since we need to rewrite some file attributes as we add them to the tarball, we've got to use the native golang implementation and so get bitten by this bug.
Required information
Issue description
When publishing a snapshot of a normal sized container which holds a sparse file, the sparse file gets expanded. This creates massive images.
In my image I have the following situation
and the resulting image grows to nearly half a TB.
Steps to reproduce
lxc snapshot CONTAINER backup
lxc publish CONTAINER/backup
and watch/var/lib/lxd/images
growInformation to attach
lxc info NAME --show-log
)Log:
architecture: x86_64 config: image.description: SCP Centos 7.3 (2017-09-04) limits.cpu: "8" limits.memory: 8GB raw.lxc: lxc.aa_profile=unconfined security.privileged: "true" user.network-config: | version: 1 config:
cloud-config
bootcmd: