Two zfs backed storage devices same profile

I have searched high and low, and apparently my Google fu is not very strong, so I have come here to ask.

How do I go by assigning two mountpoints using separate zfs pools to a container profile? I would like the root mount to be on the ssdraid pool, but have a larger and slower mount to /var on our hddraid pool.

Example:
config:
limits.cpu: “2”
description: Default LXD profile
devices:
eth0:
name: eth0
nictype: macvlan
parent: bond0.40
type: nic
root:
path: /
pool: ssd-raid
type: disk
data:
path: /var
pool: hdd-raid
type: disk

Thanks for your time.

LXD doesn’t have dynamic allocation of storage volumes, so you can do something like:

  • lxc storage volume create hdd-raid var
  • lxc profile device add default data disk path=/var source=var pool=hdd-raid

But that will cause all containers to get the same volume for their /var, which seems unlikely to be what you want.

Instead for now, I suspect you’d want to script your container creation to do something like:

  • lxc init ubuntu:18.04 NAME
  • lxc storage volume create hdd-raid NAME-var
  • lxc config device add NAME data disk path=/var source=NAME-var pool=hdd-raid
  • lxc start NAME

Only keeping the root device in the default profile.