Lxd3.6 export container with small host filesystem

Is there a way to export a over 100gb container in a 20gb host os Filesystem?
export fails cause of the rootfs (20gb) runs out of space.


During the extraction it might need more space than actually required, so you might be hitting such an issue.

But are you sure that a 100GB could be compressed to under 20GB and fit on the host?
Perhaps export on some external storage?

-root fs / ext4 30gb
-second drive (500gb) ext4
+zfs img file 200gb for containers

How to take a backup to file from the 100gb container (in zfs storage file) ?

The second drive as target did not work cause the rootfs is running out of space.
the running is is virtualized. I want to reinstall the hardware.
is there only a way to export the image in a second vm with enough rootfs space?

tried with second vm to get this 100GB container exported.
For export i need in minimum three (!!!)times a 100GB free space.

And i think i discovered a bug.
lxc export [container] [file] --container-only [and -v or --debug]
with -v or --debug the export will go with all snapshots (–container-only parameter given)

did you mean 20GB or 200GB ? i’ve never seen system images/trees compress much better than 2:1 and nowhere near 5:1. a stack of external USB hard drives is always handy (until they get filled with important data). 100GB might compress enough to fit on a 64GB memory stick.

The main issue is now finished.
I run into different problems during container export into file and import the same on a newly installed machine (In my case the same hardware)

My explorations during the process of export and import:
With current export function you need:
Container size (used space) in storage on host filesystem (rsync container fs to host os)
Second time same space amount in host os (tar the rsync’ed files)
Third time nearly same space amount in host os (gzip tar’ed file)
And if export target is on same partition, next round nearly same space (cp gzip’ed tar to target directory)

In my way it was not an easy going.
First created a second vm (first setup was lxd in vm, now bare metal) with doubled space and zfs.
This didnt worked in cause of free space runs out.
Add another space to root fs. Next try. And so on :frowning:

I think there is a way to optimize a container export to file without the need of 4 times storage wasting in root fs and target to store another mount space.