Initalize LXD to use existing ZFS pool?

I’m trying to get started with LXD and want to use an existing ZFS pool for these purposes. It’s located on a different disk than my host.

sudo lxd init

Do you want to configure a new storage pool (yes/no) [default=yes]?
Name of the new storage pool [default=default]:
Name of the storage backend to use (dir, zfs) [default=zfs]:
Create a new ZFS pool (yes/no) [default=yes]? no
Name of the existing ZFS pool or dataset: /mypool
Would you like LXD to be available over the network (yes/no) [default=no]?
Would you like stale cached images to be updated automatically (yes/no) [default=yes]?
Would you like to create a new network bridge (yes/no) [default=yes]? no
error: custom loop file locations are not supported

Any idea how to accomplish this? I also tried answering the first question with no, but then it doesn’t even query me about any existing ZFS pools.

The error message is

error: custom loop file locations are not supported

which means that LXD thinks you gave it instead a loop device (preallocated file of a ZFS filesystem).

If you run

sudo zpool list

is should show you the actual name of the existing pool. And instead of “/mypool”, type that name instead when you configure LXD.

Also, see the documentation of LXD for the storage backend,

Thanks! I’ve now given it the name (without leading /) and that worked. However, I had to empty the pool of any existing filesystems (which is fine, since I hadn’t started using them yet).

Can LXD Storage coexist with ZFS datasets I create myself in the root? e.g.:


mypool             2.02M  57.6G   192K  none

// LXD
mypool/containers   192K  57.6G   192K  none
mypool/custom       192K  57.6G   192K  none
mypool/deleted      192K  57.6G   192K  none
mypool/images       192K  57.6G   192K  none
mypool/snapshots    192K  57.6G   192K  none

// Would these be ok?
mypool/apples       … 
mypool/oranges      …

Or do they need to live in a separate pool?

You can give LXD a sub-dataset, with “mypool/lxd” in your case. LXD will create the needed dataset for you.


Alright, thanks guys. I’ll do that.