Examples of quota configuration
These examples help you understand how to configure quotas and read quota reports.
cluster1::>volume quota policy create -vserver vs1 -policy-name quota_policy_vs1_1
cluster1::>vserver modify -vserver vs1 -quota-policy quota_policy_vs1_1
Example 1: Default user quota
You decide to impose a hard limit of 50 MB for each user in vol1 by entering the following command:
cluster1::>volume quota policy rule create -vserver vs1 -policy-name quota_policy_vs1_1 -volume vol1 -type user -target "" -disk-limit 50MB -qtree ""
cluster1::>volume quota on -vserver vs1 -volume vol1 -foreground
cluster1::>volume quota report
The resulting quota report is similar to the following report:Vserver: vs1
----Disk---- ----Files----- Quota
Volume Tree Type ID Used Limit Used Limit Specifier
------- -------- ------ ------- ----- ----- ------ ------ ---------
vol1 user * 0B 50MB 0 - *
vol1 user jsmith 49MB 50MB 37 - *
vol1 user root 0B - 1 -
If any user on the system (other than the root user) tries to perform an action that would use more than 50 MB in vol1 (for example, writing to a file from an editor), the action fails.
Example 2: Explicit user quota overriding a default user quota
cluster1::>volume quota policy rule create -vserver vs1 -policy-name quota_policy_vs1_1 -volume vol1 -type user -target jsmith -disk-limit 80MB -qtree ""
This is an explicit user quota, because the user is explicitly listed as the target of the quota rule.cluster1::>volume quota resize -vserver vs1 -volume vol1 -foreground
Quotas remain in effect while you resize, and the resizing process is short.cluster1::> volume quota report
Vserver: vs1
----Disk---- ----Files----- Quota
Volume Tree Type ID Used Limit Used Limit Specifier
------- -------- ------ ------- ----- ----- ------ ------ ---------
vol1 user * 0B 50MB 0 - *
vol1 user jsmith 50MB 80MB 37 - jsmith
vol1 user root 0B - 1 -
3 entries were displayed.
Therefore, jsmith can use up to 80 MB of space on vol1, even though all other users are still limited to 50 MB.
Example 3: Thresholds
Suppose you want to receive a notification when users reach within 5 MB of their disk limits. To create a threshold of 45 MB for all users, and a threshold of 75 MB for jsmith, you change the existing quota rules by entering the following commands:
cluster1::>volume quota policy rule modify -vserver vs1 -policy quota_policy_vs1_1 -volume vol1 -type user -target "" -qtree "" -threshold 45MB
cluster1::>volume quota policy rule modify -vserver vs1 -policy quota_policy_vs1_1 -volume vol1 -type user -target jsmith -qtree "" -threshold 75MB
Since the sizes of the existing rules are changed, you resize quotas on the volume in order to activate the changes. You wait until the resize process is finished.
cluster1::>volume quota report -thresholds
Vserver: vs1
----Disk---- ----Files-----
Volume Tree Type ID Used Limit Used Limit Quota
(Thold) Specifier
------- -------- ------ ------- ----- ----- ------ ------ ---------
vol1 user * 0B 50MB 0 - *
(45MB)
vol1 user jsmith 59MB 80MB 55 - jsmith
(75MB)
vol1 user root 0B - 1 -
( -)
3 entries were displayed.
Example 4: Quotas on qtrees
Suppose you need to partition some space for two projects. You can create two qtrees, named proj1 and proj2, to accommodate those projects within vol1.
cluster1:>>volume quota policy rule create -vserver vs1 -policy-name quota_policy_vs1_1 -volume vol1 -type tree -target "" -disk-limit 20GB
Note that the correct type is tree, not qtree.cluster1:>>volume quota off -vserver vs1 -volume vol1
cluster1:>>volume quota on -vserver vs1 -volume vol1 -foreground
Alternatively, you can run the commands to re-initialize the quotas for a volume from the node that contains the particular volume.
When you display a quota report, it has several new lines: some lines are for tree quotas and some lines are for derived user quotas.
----Disk---- ----Files----- Quota
Volume Tree Type ID Used Limit Used Limit Specifier
------- -------- ------ ------- ----- ----- ------ ------ ---------
...
vol1 tree * 0B 20GB 0 - *
vol1 proj1 tree 1 0B 20GB 1 - proj1
vol1 proj2 tree 2 0B 20GB 1 - proj2
...
----Disk---- ----Files----- Quota
Volume Tree Type ID Used Limit Used Limit Specifier
------- -------- ------ ------- ----- ----- ------ ------ ---------
...
vol1 proj1 user * 0B 50MB 0 -
vol1 proj1 user root 0B - 1 -
vol1 proj2 user * 0B 50MB 0 -
vol1 proj2 user root 0B - 1 -
...
Because the root user is the owner of a file, when default user quotas were created for each of the qtrees, special tracking quotas were also created for the root user on each of the qtrees. These are shown in the lines where ID is root.
Example 5: User quota on a qtree
cluster1::>volume quota policy rule create -vserver vs1 -policy-name quota_policy_vs1_1 -volume vol1 -type user -target "" -disk-limit 10MB -qtree proj1
This is a change to an existing quota, because it changes the default user quota for the proj1 qtree that was derived from the default user quota on the volume. Therefore, you activate the change by resizing quotas. When the resize process is complete, you can view the quota report.
----Disk---- ----Files----- Quota
Volume Tree Type ID Used Limit Used Limit Specifier
------- -------- ------ ------- ----- ----- ------ ------ ---------
vol1 proj1 user * 0B 10MB 0 - *
cluster1::>volume quota policy rule create -vserver vs1 -policy-name quota_policy_vs1_1 -volume vol1 -type user -target jsmith -disk-limit 80MB -qtree proj1
Since this is an explicit quota for which a default quota already existed, you activate the change by resizing quotas. When the resize process is complete, you display a quota report.
----Disk---- ----Files----- Quota
Volume Tree Type ID Used Limit Used Limit Specifier
------- -------- ------ ------- ----- ----- ------ ------ ---------
vol1 proj1 user jsmith 61MB 80MB 57 - jsmith
cluster1::>volume quota report
Vserver: vs1
----Disk---- ----Files----- Quota
Volume Tree Type ID Used Limit Used Limit Specifier
------- -------- ------ ------- ----- ----- ------ ------ ---------
vol1 tree * 0B 20GB 0 - *
vol1 user * 0B 50MB 0 - *
vol1 user jsmith 70MB 80MB 65 - jsmith
vol1 proj1 tree 1 0B 20GB 1 - proj1
vol1 proj1 user * 0B 10MB 0 - *
vol1 proj1 user root 0B - 1 -
vol1 proj2 tree 2 0B 20GB 1 - proj2
vol1 proj2 user * 0B 50MB 0 -
vol1 proj2 user root 0B - 1 -
vol1 user root 0B - 3 -
vol1 proj1 user jsmith 61MB 80MB 57 - jsmith
11 entries were displayed.
The user jsmith is required to meet the following quota limits to write to a file in proj1:
The tree quota for the proj1 qtree.
The user quota on the proj1 qtree.
The user quota on the volume.