Solaris – setting user quota on ZFS

ZFS is a very versatile filesystem, which can hold up to 256 zettabytes of data. Yes, that’s 2^78 bytes. It is often used in enterprise solutions, because it’s just as flexible as linux LVM, but offers additional data integrity protection, and it does it so well, that it’s often recommended to use ZFS software capabilities, rather than hardware RAID.

ZFS also offers built in quotas, but they are set a little bit different than on UFS, so knowing the specific administrative commands is a must.

Example 1

We have a user named alu_tdr, whose home directory is /export/home/alu_tdr. We have to set up 4 gigabytes of user quota.

First we have to identify the dataset that holds /export/home:

# zfs list
NAME                   USED  AVAIL  REFER  MOUNTPOINT
rpool                   476K  16.5G    21K  /
rpool/clone              18K  16.5G    18K  /opt/clone
rpool/export/home       296K  16.5G    19K  /export/home
rpool/test               18K  16.5G    18K  /opt/test

As you can see, /export/home resides on root pool in rpool/export/home.

To set the user quota we’ll use zfs set:

bash-3.2# zfs set userquota@alu_tdr=4G rpool/export/home

To confirm quota was set we can use zfs get:

bash-3.2# zfs get userquota@alu_tdr rpool/export/home
 NAME PROPERTY VALUE SOURCE
 rpool/export/home userquota@alu_tdr 4G local

To see how much quota is actually in use, we can use the following command:

# zfs userspace rpool/export/home
TYPE NAME USED QUOTA
POSIX User root 127M none
POSIX User alu_tdr 228M 4G

Example 2

Now let’s set some quota for group analiza, which is supposed to be able to write up to 20 gigabytes.

bash-3.2# zfs set groupquota@analiza=20GB rpool/export/home

Now let’s display the current group quota assigned:

bash-3.2# zfs get groupquota@analiza rpool/export/home
NAME PROPERTY VALUE SOURCE
rpool/export/home groupquota@analiza 20G local

As in Example 1, to see how much of the assigned quota is in use we issue:

bash-3.2# zfs groupspace rpool/export/home
TYPE NAME USED QUOTA
POSIX Group root 217M none
POSIX Group analiza 217M 20G

Example 3

To remove user or group quota we have to use zfs set again, but this time setting quota value to “none“:

bash-3.2# zfs set userquota@alu_tdr=none rpool/export/home
bash-3.2# zfs set groupquota@analiza=none rpool/export/home

One thought on “Solaris – setting user quota on ZFS

  1. In this release, you can set a quota on the amount of disk space consumed by files that are owned by a particular user or group. You might consider setting user and group quotas in an environment with a large number of users or groups.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.