How to assign 25GB to each container using ZFS pool

Hi ,

i have zfs file system installed on my OS , i have done lxd init and selected ZFS as a filesystem you can see the options i have selected while lxd init.

root@prod:/etc/apt# lxd init
Would you like to use LXD clustering? (yes/no) [default=no]:
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 (btrfs, dir, lvm, zfs, ceph) [default=zfs]:
Create a new ZFS pool? (yes/no) [default=yes]:
Would you like to use an existing empty disk or partition? (yes/no) [default=no]:
Size in GB of the new loop device (1GB minimum) [default=30GB]: 460GB
Would you like to connect to a MAAS server? (yes/no) [default=no]:
Would you like to create a new local network bridge? (yes/no) [default=yes]:
What should the new bridge be called? [default=lxdbr0]:
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:
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 a YAML “lxd init” preseed to be printed? (yes/no) [default=no]:

now i want to assign 25gb to each container whenever i launch new container it should be created with the 25gb limit . is there any command to set the limit so that i can incorporate that command in my lxc launching bash script so that whenever new container launches it will launch with 25gb disk limit.

You can set the volume.size setting on the storage pool which applies to all new volumes on that storage pool.


lxc storage set default volume.size 25G


Thanks @tomp for quick response.

Can you please tell me how to set the limit of particular container ?

like after launching new container with 25gb i want to increase its size to 30gb so how would i do that ?

lxc config device override c1 root size=30GB

Thanks a lot @tomp