Error adding storage to container

i have created some storage
truncate -s 100GB /var/container_storage
zpool create container_storage /var/container_storage
lxc storage create container_storage zfs source=container_storage

I then created a profile for this storage
lxc profile create container_profile
lxc profile device add container_profile root disk pool=container_storage path=/

And created a container instance with that profile from an image that I have
lxc launch container_image container_machine -p container_profile

What I want to do now is to add some additional storage at a particular place in that container
I have a device that I want to use.
I have created a new zpool to use this device
zpool create container_extra /dev/sdb

That creates successfully

However, I’m having issues adding that new storage to the existing container

lxc profile device add container_profile extra_storage disk pool=container_extra path=/some/customer/container/path/

This displays the following error:

Error: Device validation failed for "extra_storage": Disk entry is missing the required "source" property

You’d need to create a LXD pool for that zpool:

  • lxc storage create container_exta zfs source=container_extra

And then create a volume on it and attach it

  • lxc storage volume create container_extra my-container
  • lxc config device add NAME extra disk source=my-container pool=container_extra path=/some/path

You can do that in a profile but then all containers will share the exact same volume, so in your case you may want to add the extra storage on a per-container basis.

1 Like