Quota not being enforced

ghostrider

Cadet
Joined
Apr 15, 2023
Messages
7
Hello,

I've been looking for an answer to this and I haven't found anything, so I'm raising this post.
I have a dataset with no children that I want to set some quotas on, so for this purpose I have set the quota to 3GB. However, to my surprise when I try to extrapolate the quota by creating a file I see that the quota is not enforced and I can create files sizes with several times beyond what's defined, just as if having a quota configured or not makes no difference.

This is the quota definition of my dataset:

quota.png


This is what is displayed as free space for this dataset after the quota is defined, which looks as expected:

quota2.png


But after the quota is set, when I try to fill a file with the contents of /dev/zero, I can extrapolate it without any problems:

root@cloud:/mnt/data # su -m www -c 'cat /dev/zero > A' ^C root@cloud:/mnt/data # ls -lah total 189 drwxrwx--- 8 www www 14B Nov 9 22:41 . drwxr-xr-x 3 root wheel 3B Oct 15 14:10 .. [B]-rw-r--r-- 1 www www 482G Nov 9 23:01 A[/B] (...)

I'm mounting the dataset inside a jail, and from there I'm trying to verify that the quota is working, although I don't think it makes any difference.


Is this supposed to happen, can anyone explain this behavior?
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
This seems a bit extreme, but it's true that quotas are not strictly enforced to the byte. For performance reasons, quotas are a little bit fuzzy, but my understanding is that we're talking about a few MB or so. Maybe this goes up to a whole TXG's worth of data?
 

ghostrider

Cadet
Joined
Apr 15, 2023
Messages
7
This seems a bit extreme, but it's true that quotas are not strictly enforced to the byte. For performance reasons, quotas are a little bit fuzzy, but my understanding is that we're talking about a few MB or so. Maybe this goes up to a whole TXG's worth of data?

This is not a difference in a few MB, but in the GB/TB range.
The quota, in the example above, is set to 3GB, but I'm able to create files in this dataset of 482GB simply because I stop the command and didn't let running for longer, if it kept going it would reach differences of TB.

If the quota is not enforced, what's the point?
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
Well, the 400+ GB are all zeros, right? So they're compressing down substantially. What is the actual usage reported by ZFS?
 

ghostrider

Cadet
Joined
Apr 15, 2023
Messages
7
Well spotted! The file is stored with zeros and that was why I was experiencing the problem that neither the quota was enforced nor the available space of the dataset was decreasing as the file grew.
If I use /dev/random instead, the quota is now enforced as the available space decreases:
root@cloud:/mnt/data # su -m www -c 'cat /dev/random > A' cat: stdout: Disc quota exceeded

I wasn't aware that this was due to compression, thanks for pointing that out!
 

ghostrider

Cadet
Joined
Apr 15, 2023
Messages
7
Btw, while setting a quota in another mounted dataset, I get the following error:

quota.png


This dataset is currently mounted in a Linux VM, could this be the cause of the error?
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
I'm not sure why it's saying that it's invalid, is that dataset for an SMB share?
 
Top