Quotas with ZFS on Linux

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

jonsnow

New Member
Jul 1, 2020
2
0
1
I built a storage device using ZFS on Linux for some of my users a few years ago. These are scientists/undergrads who are capable of generating a lot of data and they've been mostly responsible about it. Last weekend though, one of the new students in the lab managed to fill the filesystem by generating 14TB of data between Friday evening and Monday morning. I didn't catch it as I was away for the weekend and unplugged. Now I'm interested in implementing quotas on our NFS clients I tried using the post here. I have everything working except 'zfs userspace zfs/filesystem' isn't actually showing the quota I've set.

#Set home/user quota to 2TB
zfs set quota=2T home/user
#Get the quota property for home/user
zfs get quota home/user
NAME PROPERTY VALUE SOURCE
home/user quota 2T local
#Userspace doesn't reflect the quota. My understanding is that there should not be a delay here. I've waited 24+ hours at this point and it still shows no quota set
zfs userspace home/user
TYPE NAME USED QUOTA OBJUSED OBJQUOTA
POSIX User user 836G none 2.87K none

I've setup the following in root's crontab on my NFS clients.

0 * * * * ssh storage01 '/usr/sbin/zfs userspace -npH home' > /srv/.quota

And then in /home/user/.bash_profile

alias tmpPass='echo "$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c10)"'
function quota () {
echo -n "Quotas:"
cat /srv/.quota | \
awk -F'\t' '$2 == '$(id -u)' { print $3 "\n" $4 }' | \
numfmt --to=iec | \
tr '\n' ' ' | \
awk '{ print " home: " $1 " used of " $2 }'
}
quota

Everything works beautifully except the quota is still not set according to 'zfs userspace home/user'. At login, I get:

Last login: Wed Jul 1 07:58:37 EDT 2020 from $IP on pts/78
Quotas: home: 836G used of 0

I'm running CentOS 7.6 so the ZFS kernel module and packages are a bit out of date as is the kernel.

[root@storage01 home]# uname -a
Linux storage01.domain 3.10.0-957.5.1.el7.x86_64 #1 SMP Fri Feb 1 14:54:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
[root@storage01 home]# rpm -qa | grep zfs
zfs-release-1-6.el7.noarch
libzfs2-0.7.12-1.el7_6.x86_64
kmod-zfs-0.7.12-1.el7_6.x86_64
zfs-0.7.12-1.el7_6.x86_64

Does anyone have ideas as to what's gone wrong here?