How to import existing storage VOLUME that was created with lxd

Hi struggling with how to actually import a storage volume that was created with lxd.

Can’t seem to create one and use the old one as source, doesn’t seem to be an import command? so wondering whats the viable way to do this as importing existing zfs container storage is easy but the volumes seem less so.

At the moment im having to delete the volume from the backup.yml before re-importing as i’ve got no way of importing the volume.

I know its probably possibly to create a temp dataset and zfs send the contents to back it up then recreate the volume in lxd and zfs receive but that seems to be going round the houses and not ideal.

Any pointers? :slight_smile:



So to clarify, is this a case where you’re using lxd import to import existing ZFS datasets or is it a case where you’re using lxc import with a tarball?

If the former, it shouldn’t be too difficult to expand the backup.yaml to also include some details on the relevant custom volumes and then having the lxd import logic know how to re-create those entries if they’re missing.

@brauner @monstermunchkin

Sorry for the delay, yes it was regarding “lxd import”

I think in the end I just manually added the device as a disk after doing zfs mount.


sudo zpool import -F -f -d /var/snap/lxd/common/lxd/disks/ <image.file>

This worked for me .