How do I move an image from one storage pool to another?

I’m getting started with btrfs, having used the a dir pool as my default until now. I’d like to migrate at least one image to the btrfs pool so that I get speedups, but I don’t see any way to do this.

I’ve looked at lxc image copy and lxc image import, but neither allows storage pool to be specified. I’ve looked at lxc move, but that seems to apply only to containers.

Okay, it seems like the images in /var/lib/lxd/storage-pools/*/images/ are effectively a cache-- copied once from /var/lib/lxd/images/ the first time they’re needed (i.e. lxc launch of that image in that storage pool).

Similarly, lxc publish is slower than I expected on btrfs, because it needs to update /var/lib/lxd/images/ even though creating a copy of a filesystem is fast on btrfs.

That’s correct, LXD always needs images available as some re-usable file in /var/lib/lxd/images, that’s typically a compressed tarball though it can also be a squashfs in some situations.

The sha256 of those combined files makes up the image fingerprint.

If all you care about is being able to quickly create more of the same container and don’t need guarantees about it being immutable or being re-usable on other servers, you can just use lxc copy which on most backends will be pretty fast.

hi all,
I moved my containers from a zfs storage pool to another one, then I moved default profile but I cannot understand how to move the image I have onthe old pool to the new one.

Now I have:

lxc storage list
±-----±------------±-------±------------±--------+
| NAME | DESCRIPTION | DRIVER | SOURCE | USED BY |
±-----±------------±-------±------------±--------+
| lxd | | zfs | storage/lxd | 1 |
±-----±------------±-------±------------±--------+
| stor | | zfs | stor/lxc | 10 |
±-----±------------±-------±------------±--------+

lxc storage info lxd
info:
description: “”
driver: zfs
name: lxd
space used: 915.70MB
total space: 7.52TB
used by:
images:

  • e303951d98a8de2bd572aae3296ae53e7cb5fe055e147fae99d341e12e05e727

Someone can help me please? I would like to delete the old pool and remove disks

Thanks

You don’t need to. The images are primarily stored as a pool-agnostic tarball in the images directory.
The per-pool record is what’s used to have near instant container creation, that’s automatically created the first time you use a given image.

Thank you! So I can destroy the pool without negative effects on containers?

Yep.

Note that lxc storage delete will not let you delete a storage pool which would affect containers, it will only let you delete a storage pool that has no instances and no custom volumes on it. It will then delete the image volumes from it (as noted, no consequences) and then delete it.