ZFS is loaded with useful features, just a while ago I took a peak at setting quotes. Using just a few commands you limit the amount  of storage a certain pool can take.

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
huginn                                                     quota     none   default
huginn/dataset                                           quota     none   default
huginn/dataset@autosnap_2017-04-01_00:00:02_monthly      quota     -      -
huginn/dataset@autosnap_2017-04-10_00:00:01_daily        quota     -      -
huginn/dataset@autosnap_2017-04-19_14:00:01_hourly       quota     -      -
jbod1                                                      quota     none   default
jbod1/users                                                quota     none   default
jbod1/users/servers                                        quota     -     -

As you see, no quota’s. Now let’s add one :

zfs set quota=5TB jbod1/users/server

The format : zfs set quota=$size $pool

Let’s check again :

[root@huginn HG00731]# zfs get -r quota jbod1/users/wdecoster
NAME                                                       PROPERTY  VALUE  SOURCE
jbod1/users/server                                      quota     5T     local
jbod1/users/server@autosnap_2017-04-01_00:00:02_daily   quota     -      -
jbod1/users/server@autosnap_2017-04-02_00:00:01_daily   quota     -      -
jbod1/users/server@autosnap_2017-04-03_00:00:01_daily   quota     -      -
jbod1/users/server@autosnap_2017-04-03_13:00:01_hourly  quota     -      -
jbod1/users/server@autosnap_2017-04-03_14:00:01_hourly  quota     -      -

Simple enough; now some practical warnings :

  • full is full; you can’t remove, edit or overwrite data once its 100% full. Even tricks like “echo > big_file” won’t work. You need to either increase or drop the quota before its possible
  • You can’t decrease a quota … once its allowed 5TB only destroying it will release the limit.