Add additional storage pool to profile

I’d like to add an additional storage pool (beyond the root device) to a profile that gets mounted at a specific mount point within the container, that keeps each container’s data separate within the additional pool.

To get more specific, the container’s rootfs is in a ceph pool, which is fine for the base system, but there is some highly volitile data that I woud prefer to keep local to the host. So I added an additional dir pool that I’d like to present in an unshared, per-container mount point.

When I try to add the disk device referencing the additional pool, the device requires a source field, which seems to either point to a directory or block device on the host, or a shared volume. In either case the new mount seems to be a shared, not a per container space. Do I have to manually create volumes for each container or is there some other way to have the profile do this?

That defeats the purpose of a profile. If you add a volume or disk device to a profile, it will be shared across all instances.

Yes, you do need to create a volume or disk device for each container if you want to keep the data separate.

Apologies for replying to a 2-year old post, but I had the same question and I saw 3 posts with same/similar questions.

How to autoprovision additional disks using profiles or Ansible in a cluster? (I believe this post has the answer)

I think what yokem55 wanted to say was: “Is there a way to tell LXD to create a new storage volume and attach it to newly created instance and mount it on some location inside the instance, all of this done automatically when we launch new instance (maybe through command line parameters or through profile config?”

And as per the last post shared above, currently there is no way to make the creation of new storage volumes automated through the profiles or any other way. The storage volume should be created first and then attached to the instance.