Setting a ZFS Dataset and User Disk Quota
In ZFS we can manage disk quotas via two methods:
- User ID Quota Limits
- Dataset Quota Limits
User Quota Limiting
We can enforce a blanket limit that automatically applies to every user who writes to the dataset, either via default settings or specific per-user overrides:
Setting the Default User Quotas
To set the default userspace quota:
zfs set defaultuserquota=10G zpool/some_dataset
To get the value we can simply do the same command replacing set with get and removing the parameter value.
zfs get defaultuserquota zpool/some_dataset
Setting a specific User Quota
To set a quota for a specific user we may use:
zfs set userquota@username=5G zpool/some_dataset
To remove it we can use:
zfs set userquota@username=none zpool/some_dataset
Dataset Quota Limiting
To enforce a quota to an entire dataset use the following command:
# Execute with sudo if not root
zfs set quota=10G zpool/some_dataset
To get the quota value set (if any), use:
zfs get quota zpool/some_dataset
We can also enforce only limits on the data within the directory and ignore snapshots from the storage calculations:
zfs set refquota=20G zpool/some_dataset