How to move the default pool to another disk

Hello,

By default, the LXC will create a zfs pool as follows:

+---------+--------+--------------------------------------------+-------------+---------+
|  NAME   | DRIVER |                   SOURCE                   | DESCRIPTION | USED BY |
+---------+--------+--------------------------------------------+-------------+---------+
| default | zfs    | /var/snap/lxd/common/lxd/disks/default.img |             | 8       |
+---------+--------+--------------------------------------------+-------------+---------+

I would like to know how I can move this zfs pool to another directory or create a new zfs pool in another directory then move all the containers to new pool?

For LXD managed loop files, the only location we support is /var/snap/lxd/common/lxd/disks.

Now there are a few ways around that in this case:

  • You could create a pool using a dedicated disk or partition, this would also speed things up a fair bit for you.
  • You could move the content of /var/snap/lxd/common/lxd/disks to some other path and then setup a bind-mount entry in /etc/fstab to bind-mount that path over /var/snap/lxd/common/lxd/disks, then reboot your system to have it get setup properly.
  • You could manually create your own ZFS pool using whatever backing you want (including files) and then just tell LXD to use that pool instead (it will be up to you to ensure that the pool is online by the time LXD starts up, but most Linux distros have ZFS init scripts that do that).