How to move containers to a new storage pool on the same host

I didn’t see this anywhere, it’s not hard there’s just one gotcha you cant use the same container name as the destination. So I thought I’d put it here just in case someone’s looking for it

Create the new pool

lxc stop container_name
lxc move container_name temp_container_name -s new_storage_pool
lxc move temp_container_name container_name
lxc start container_name

18 Likes

Hi, If I am okay with the new name, Can I keep it?

I expect so.

Thanks, I always create a small independent partition for OS. This saved my day.

How would one move all container root volumes to a new storage pool on a different disk? Looking to move the root of all my containers into a new NVME-backed pool to improve performance and reduce system IO load on the data storage pools.

You can just do lxc move container_name -s new_storage_pool and LXD will manage the temporary name for you.

2 Likes

Create a new storage pool using lxc storage create and then move instances using lxc move

Thanks !
Will this also move other volumes that are attached to my containers? I’d rather like that not to be the case. (For instance, a custom volume attached at /storage that would be several terabytes large, more than the SSD can contain)

No custom volumes are not moved with instances.

1 Like