ZFS quota
April 19, 2017

ZFS quota

Posted on April 19, 2017  •  2 minutes  • 254 words  •  Suggest Changes

ZFS is brimming with valuable features and functions, and recently, I had the opportunity to explore setting quotas. With just a handful of commands, you can effectively restrict the amount of storage that a specific pool can consume.

First let’s check if there is no quota set :

zfs get quota

This would result in something like :

# zfs get quota
NAME                                                       PROPERTY  VALUE  SOURCE
pool                                                     quota     none   default
pool/dataset                                           quota     none   default

As you may have noticed, there are currently no quotas set. Now, let’s proceed to add a quota to the desired resource :

zfs set quota=5TB pool/dataset

This would add a 5TB limit to pool/dataset.

The format :

zfs set quota=$size $pool

To find the exact size of a volume and make the current size the limit :

zfs get -Hp used pool/volume
pool/volume        used    19321891149600  -

Set the limit to exactly the size of pool/volume (making it “almost” readonly)

zfs set quota=19321891149600 pool/volume

It’s ofcourse also possible to just set the readonly flag on :

zfs set readonly=on pool/volume

Let’s check again :

zfs get -r quota pool/data
NAME                                                       PROPERTY  VALUE  SOURCE
pool/data                                      quota     5T     local
pool/data@autosnap_2017-04-01_00:00:02_daily   quota     -      -

Simple enough; now some practical warnings :


If you enjoyed this website, consider buying me a Dr. Pepper

Buy me a Dr PepperBuy me a Dr Pepper