Fastest way to move all containers to new storage backend


(lxd) #1

I’m currently running LXD with the dir storage type which was the default some time ago (now replaced with BTRFS).
I would like to move all my containers to the BTRFS storage type. What’s the fastest way to achieve this without losing container data and metadata such as their current IPs?


(Stéphane Graber) #2

You can add a second storage pool and then use lxc move with the --storage option to move the containers between storage pools.


#3

If you are not using snap lxd (that is, < 3.2), a fast way could be to setup another lxd server on the same local network, copy all containers to the temporary LXD server, and copy them back once you have a new storage. If that’s not possible you can do export to image and back to container, but that’s not fast at all.