ZFS On Linux Quota
As you may know, linux quota tool doesn’t work with ZFS, this is a known issue and I have previously hacked around it but I’ve recently had issues with the very rudimentary ZFS quota script I deployed at work for two reasons:
- A new ZFS server was not in LDAP so was unaware of Usernames it only showed UIDs
- Partial matches on Usernames caused weirdness
So I moved to change the script a little, it now outputs as UIDS, this has an advantage that the server does not need to know the usernames, so you can have local users on remote servers etc. It also makes the output more obscure, due to it being readable by all, it containing names meant it could leak some personal details to systems that do not include the ability to view it.
This change meant that the new server output and client reader is incompatible with the old, so the previous version is now labelled as v1. Due to this breaking change, I thought it would be best to split the code out from my monolithic git repo to it’s own zfs-quota repository meaning others can contribute easier.
The change also highlighted that the UID output (previously name) could partial match, the previous version just hoped and user some poor-mans greping to only output a single match. Using UID also meant that the UID could possibly match a ZFS Byte output. So the new version actually checks the UID field and will only return if that value is a complete match to the UID the system is searching for.
So please find my ZFS on Linux Quota scripts on github, there’s a Server script and a client script, both of which are targeting CentOS7, and they at least work on Fedora 32/33/34 as well as CentOS8 but they should work on pretty much any Linux distro. Hopefully the client script is simple enough for others to understand and if required port to Windows or MacOS.