Quotas limit the amount of disk space a filesystem can use. The traditional model of filesystems has changed with ZFS because of the introduction of pools. Each pool (which can be made up of a disk slice, a whole disk, or several disks) can have a jaw-dropping big number of filesystems created in a hierarchial manner. This tech-recipe describes the use of quotas with ZFS.
Filesystems within a ZFS pool are hierarchially arranged, and the characteristics of a filesystem are carried on to filesystems created under them. This is important to keep in mind when working with quotas and other ZFS characteristics.
Given a user home directory structure in the techrx pool:
techrx/home
techrx/home/davak
techrx/home/qmchenry
techrx/home/MickeyMouse
To limit the space available to all home directories to 100GB (so that the sum of all home directories must be less than this), use the command:
zfs set quota=100G techrx/home
The quota of a descendent filesystem (like techrx/home/qmchenry) can be additionally constrained. To set my home directory to be able to use no more than 10GB of disk space, I use the following:
zfs set quota=10g techrx/home/qmchenry
Since davak is a sworn Windows user, we can set his quota to 5MB (and we feel that is being generous):
zfs set quota=5m techrx/home/davak
Since MickeyMouse has been writing some awesome tech-recipes, we do not want to limit his space. If his quota was previously set at 10GB, we can remove this quota with the following:
zfs set quota=none techrx/home/MickeyMouse
Note that the quota of the ancestor (techrx/home) still applies to MickeyMouse’s directory.