2

On my host, I have Ubuntu 16.10:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.10
Release:    16.10
Codename:   yakkety

and I use LXD from the stable repo:

lxc --version
2.12

I currently have a few containers created with DIR as the storage backend:

root@Ubuntu-1610-yakkety-64-minimal ~ # lxc storage show default
config:
  source: /var/lib/lxd/storage-pools/default
name: default
driver: dir
used_by:
- /1.0/containers/elasticsearch-internal
- /1.0/containers/yyy-dev
- /1.0/containers/yyy-pre-prod
- /1.0/containers/xxx-dev
- /1.0/containers/xxx-dev/snapshots/snap1
- /1.0/containers/mysql-dev
- /1.0/containers/mysql-dev/snapshots/snap01
- /1.0/containers/mysql-preprod
- /1.0/images/2cab90c0c342346ea154bc2e8cacdae752a70747a755ce1f2970c9a9ebb5fe8c
- /1.0/images/d51e7b34d5f470912bc45a6270278d7990b049d826e33dd8affe9b54aaf0d7ee
- /1.0/profiles/default

I also have 2 x 2TB SATA III HDDs mirrored with ZFS:

root@Ubuntu-1610-yakkety-64-minimal ~ # zpool list -v
NAME   SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
lxdstorage  1.81T   361M  1.81T         -     0%     0%  1.00x  ONLINE  -
  mirror  1.81T   361M  1.81T         -     0%     0%
    sdc      -      -      -         -      -      -
    sdd      -      -      -         -      -      -

Now, since version 2.12, LXD has the new storage API: lxd/storage-backend

I need to move the actual containers from DIR to ZFS storage. What I have done so far is create the new storage:

lxc storage create pool1 zfs source=lxdstorage/containers

root@Ubuntu-1610-yakkety-64-minimal ~ # lxc storage list
+---------+--------+------------------------------------+---------+
|  NAME   | DRIVER |               SOURCE               | USED BY |
+---------+--------+------------------------------------+---------+
| default | dir    | /var/lib/lxd/storage-pools/default | 11      |
+---------+--------+------------------------------------+---------+
| pool1   | zfs    | lxdstorage/containers              | 0       |
+---------+--------+------------------------------------+---------+

How can I move the containers from default to pool1?

1

There is still no direct way to do this (today version 2.14).

The workarround is stop container, publish as image, delete original container and init it in new storage pool:

lcx stop c1
lxc lxc publish -f c1 --alias c1
lxc delete c1
lxc init c1 c1 -s <new pool>
lxc start c1
lxc image delete c1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.