Migrate from one storage pool to another


I had a single storage zfs pool and now i want to shift all the containers to another zfs pool since the previous pool is underutilized and i want to save the cost of storage i have already created a new zfs pool what is best solution to achieve my goal???

| default | | zfs | default | 61 |
| stg | | zfs | stg | 0 |

i have tried it by

lxc move container container-tmp -s stg
lxc move container-tmp container 
lxc start container

all containers are running fine but if i remove old storage from linux VM it starts giving below error

Error: Get "http://unix.socket/1.0": dial unix /var/snap/lxd/common/lxd/unix.socket: connect: connection refused

Please can you tell me the LXD version?

root@stg-us-east1-b-001:~# snap list
Name Version Rev Tracking Publisher Notes
core 16-2.49.2 10958 latest/stable canonical✓ core
core18 20210309 1997 latest/stable canonical✓ base
lxd 4.9 18772 4.9/stable canonical✓ -

I’ve just tried this now on LXD 4.13 and it worked OK:

lxc storage create zfs1 zfs
lxc storage create zfs2 zfs
lxc init images:ubuntu/focal c1 -s zfs1
lxc move c1 -s zfs2
sudo zfs list | grep c1
zfs2/containers/test_c1                                                        209M  18.7G      209M  /var/lib/lxd/storage-pools/zfs2/containers/test_c1

So is it possible for you to try with 4.13 please?


Even, you can move lxd containers between different storage systems, between ceph to zfs or vice versa.

I’m getting Error: Invalid number of arguments if I try lxc move c1 -s zfs2.

It works if I also rename the container (e.g. c1_tmp) in the same command.

Apparently this interface has changed? How to do that without also having to rename it temporarily?

Sounds like a bug please can you log it on github issues. Thanks

It turns out LXD version 4.0.8, which is what you get by default in the latest Ubuntu Server LTS (20.04), does not have that feature yet.
Renaming the container at the same time “does a copy+delete”, which is already implemented in that version.

I did not expect that.