How can I control the file system path used by lxc import commands to avoid failures?

Hi. I have a Ubuntu 20.04 LTS server. The OS install is in a 16G USB drive and the ZFS pool is a VDEV composed of 2 physical 500G drives, mirrored. I’ve been running this setup for years[1]. The relevant file systems look as follows:

$ df -h
Filesystem                         Size  Used Avail Use% Mounted on
/dev/mapper/swarm--vg-root          14G  4.7G  7.8G  38% /
tank                               450G   61G  389G  14% /mnt/tank
tank/lxd                           389G  128K  389G   1% /mnt/tank/lxd
tank/lxd/containers                389G  128K  389G   1% /mnt/tank/lxd/containers
tank/lxd/custom                    389G  128K  389G   1% /mnt/tank/lxd/custom
tank/lxd/deleted                   389G  128K  389G   1% /mnt/tank/lxd/deleted
tank/lxd/images                    389G  128K  389G   1% /mnt/tank/lxd/images
tank/lxd/virtual-machines          389G  128K  389G   1% /mnt/tank/lxd/virtual-machines
tank/lxd/deleted/containers        389G  128K  389G   1% /mnt/tank/lxd/deleted/containers
tank/lxd/deleted/custom            389G  128K  389G   1% /mnt/tank/lxd/deleted/custom
tank/lxd/deleted/images            389G  128K  389G   1% /mnt/tank/lxd/deleted/images
tank/lxd/deleted/virtual-machines  389G  128K  389G   1% /mnt/tank/lxd/deleted/virtual-machines

The import commands I’ve tried are:

  1. lxc import --verbose arma@wednesday.tar.gz
  2. lxc import --verbose arma@wednesday.tar.gz arma --storage lxd

The import commands fail with “out of space” errors. The .tar.gz file is 61G, so there’s plenty of space in the pool. The storage pool is lxd:

$ lxc storage list
| lxd  | zfs    | tank/lxd |             | 1       |

What I’ve observed is that, by default, LXC is using the 16G USB’s root file system mounted at /. I’m guessing LXC is extracting the .tar.gz file somewhere in the root file system instead of the ZFS tank pool or some other location that I’d like it to use before importing the container into the lxd storage pool.

Because of this, I can never lxc import successfully. Is there a way to control the path for the whatever working directory LXC is using during lxc import commands? If not, then what should I do to import/restore this backup successfully, given the above constraints?

[1]: Recently, LXC crapped out with a corrupted SQLite database (not the first time this has happened out of the blue) and I had no other option except to destroy everything and import a previous backup…

You can create a custom volume on your desired storage pool using:

lxc storage volume create <pool> <volume name> size=nGB

And then specify it for use with backups:

lxc config set storage.backups_volume <pool>/<volume name>

It doesn’t have to be the same pool you’re importing into.