As a part of new features in Solaris 11, you can set a limit on the amount of space consumed by a specific group. The command to set quota on specific group is :
# zfs set groupquota@[group]=[size] [dataset]
Similarly, users quota can be managed through the use of the userquota property. The command to do so is :
# zfs set userquota@[user] [dataset]
The default value for the default user and group quotas will be the value none which means no default quota is being used. Only when a real value is assigned will the default quota values be used.
Examples:
Let us consider few examples to understand different ways to set user/group quotas on ZFS datasets. As shown in example below a default quota of 2GB is set on FS sandbox/fs4.
# zfs set defaultuserquota=2G sandbox/fs4 # mkfile 100m /sandbox/fs4/file.1 # chown marks:staff /sandbox/file.1
You can verify the default quota set on dataset using :
# zfs userspace sandbox/fs4 TYPE NAME USED QUOTA SOURCE POSIX User marks 100M 2G default POSIX User root 3K 2G default
Example 1
Now give marks an explicit 50G quota which overrides the default quota.
# zfs userquota@marks=50G sandbox/fs4
Verify the changed value of user quota.
# zfs userspace sandbox/fs4 TYPE NAME USED QUOTA SOURCE POSIX User marks 100M 50G local POSIX User root 3K 2G default
To return a user to the default setting:
# zfs userquota@marks=default sandbox/fs4
# zfs userspace sandbox/fs4 TYPE NAME USED QUOTA SOURCE POSIX User marks 100M 2G default POSIX User root 3K 2G default
If it is desired to have no quota then you can still use the already existing semantic of setting a quota to none.
# zfs userquota@marks=none sandbox/fs4
# zfs userspace sandbox/fs4 TYPE NAME USED QUOTA SOURCE POSIX User marks 100M none local POSIX User root 3K 2G default
Quota values can also be retrieved via the zfs get sub-command
# zfs get userquota@marks sandbox/fs4 NAME PROPERTY VALUE SOURCE sandbox/fs4 userquota@marks none local
Note how user timh picks up a default quota on the same dataset
# zfs get userquota@timh sandbox/fs4 NAME PROPERTY VALUE SOURCE sandbox/fs4 userquota@timh 2G default
Example 2
The default group quotas work the same as default user quotas. The only difference is that you use:
# zfs set groupquota@[group]=[size] [dataset]
For example :
To set a quota of 50G for the group staff :
# zfs groupquota@staff=50G sandbox/fs4
Verify the changed value of user quota.
# zfs groupspace sandbox/fs4 TYPE NAME USED QUOTA SOURCE POSIX Group staff 100M 50G local POSIX Group root 3K 2G default
Few other commands which can be used in similar way as userquota are :
# zfs groupquota@staff=none sandbox/fs4 ### to remove group quota # zfs get groupquota@staff sandbox/fs4 ### to get group quota details