ZFS file system and zpool size allocation

lxdzfs

I am using zfs on some of my lxc containers at start when I was configuring I allocated 500GB

my zpool list

NAME   SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
lxd    496G   247G   249G         -    44%    49%  1.00x  ONLINE  

my zfs listNAME

    USED  AVAIL  REFER  MOUNTPOINT
lxd                                                                                   247G   234G    19K  none
lxd/containers                                                                        246G   234G    19K  none
lxd/containers/container1                                                             36.6G   234G  36.9G /var/lib/lxd/containers/container1.zfs
lxd/containers/container2                                                             210G   234G   210G  /var/lib/lxd/containers/container2.zfs
lxd/deleted                                                                           304M   234G    19K  none
lxd/deleted/images                                                                    304M   234G    19K  none
lxd/deleted/images/b5f3a547289fabf26d90250605dc3067f1863ee46c802f004aa97954cc852c33   304M   234G   304M  none
lxd/images                                                                            304M   234G    19K  none
lxd/images/be7cec7c948958adfbb9bc7dbd292762d2388cc883466815fc2b6bc06bf06f5a           304M   234G   304M  /var/lib/lxd/images/be7cec7c948958adfbb9bc7dbd292762d2388cc883466815fc2b6bc06bf06f5a.zfs

I do not understand Now I want to crate a 3rd container for which I only need 10GB of space but all containers seems to allocate 500GB/250GB space

How do I create a new container with 10GB size ?

Best Answer

Your zpool is 500GB.

By the look of it, when you create a container it just creates a ZFS filesystem (dataset) for it. ZFS filesystems all share the space of the pool, so they will all show the same total size and available space.

If you want to specifically restrict a container to only 10GB you can set a quota on the relevant dataset, although I see little benefit in doing this.

Related Topic