以下示例将帮助您了解如何配置配额和阅读配额报告。
cluster1::>volume quota policy create -vserver vs1 -policy-name quota_policy_vs1_1
cluster1::>vserver modify -vserver vs1 -quota-policy quota_policy_vs1_1
您决定通过输入以下命令对 vol1 中每位用户实施 50 MB 的硬限制:
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生成的配额报告类似于以下报告:
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 -第一行显示了已创建的默认用户配额(包括磁盘限制)。与所有默认配额一样,此默认用户配额不显示有关磁盘或文件使用量的信息。除已创建的配额之外,它还显示了另外两个配额:当前在 vol1 上拥有文件的每位用户各一个配额。这些附加配额是自动根据默认用户配额派生的用户配额。与默认用户配额相同,用户 jsmith 的派生用户配额也具有 50 MB 的磁盘限制。root 用户的派生用户配额是跟踪配额(无限制)。
如果系统上任何用户(root 用户除外)尝试执行的操作将在 vol1 中占用超过 50 MB 的空间(例如,从编辑器对文件进行写入),该操作将失败。
cluster1::>volume quota policy rule create -vserver vs1 -policy-name quota_policy_vs1_1 -volume vol1 -type user -target jsmith -disk-limit 80MB -qtree ""这是一个显式用户配额,因为其中明确将用户列为配额规则的目标。
cluster1::>volume quota resize -vserver vs1 -volume vol1 -foreground调整大小时,配额保持有效;而且调整大小过程耗时很短。
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.现在,第二行显示了 80 MB 的磁盘限制和配额说明符 jsmith。
因此,jsmith 最多可以使用 vol1 上 80 MB 的空间,而其他所有用户的可用空间量仍限制为 50 MB。
假设您希望在用户使用的空间量距磁盘限制还有 5 MB 时收到通知, 那么请通过输入以下命令更改现有配额规则,以便为所有用户创建 45 MB 的阈值并为 jsmith 创建 75 MB 的阈值:
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
由于现有规则的大小已更改,因此必须调整卷上的配额大小以便激活更改。请等待调整大小过程完成。
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.阈值显示在磁盘限制列中,并括在圆括号中。
假设您需要进行分区以便为两个项目提供一些空间, 则可以创建分别名为 proj1 和 proj2 的两个 qtree,以将这些项目存放在 vol1 中。
cluster1:>>volume quota policy rule create -vserver vs1 -policy-name quota_policy_vs1_1 -volume vol1 -type tree -target "" -disk-limit 20GB请注意,正确类型是 tree,而不是 qtree。
cluster1:>>volume quota off -vserver vs1 -volume vol1 cluster1:>>volume quota on -vserver vs1 -volume vol1 -foreground
或者,也可以从包含特定卷的节点运行命令以重新激活该卷的配额。
显示配额报告时,该报告包含几个新行:一些行用于树配额,另一些则用于派生用户配额。
----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 ...已创建的默认树配额将显示在第一个新行中,并且 ID 列会显示星号 (*)。由于卷上设置了默认树配额,因此 ONTAP 会自动为卷中的每个 qtree 创建派生树配额。这些派生树配额显示在树列中的 proj1 和 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 - ...如果为 qtree 启用了配额,则卷上的默认用户配额会自动为该卷所含的所有 qtree 所继承。添加第一个 qtree 配额时,将在所有 qtree 上启用配额。因此,系统将为每个 qtree 创建派生的默认用户配额。这些派生用户配额显示在 ID 为星号 (*) 的行中。
由于 root 用户是文件的所有者,因此,为每个 qtree 创建默认用户配额时,还会为每个 qtree 上的 root 用户创建特殊的跟踪配额。这些跟踪配额显示在 ID 为 root 的行中。
cluster1::>volume quota policy rule create -vserver vs1 -policy-name quota_policy_vs1_1 -volume vol1 -type user -target "" -disk-limit 10MB -qtree proj1
这是对现有配额进行的更改,因为它更改了 proj1 qtree 从卷上的默认用户配额派生而来的默认用户配额。因此,请通过调整配额大小来激活更改。您可以在调整大小过程完成之后查看配额报告。
----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
由于这是一个显式配额,而其默认配额已存在,因此,请通过调整配额大小来激活更改。您可以在调整大小过程完成之后查看配额报告。
----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.
用户 jsmith 必须满足以下配额限制才能向 proj1 中的文件写入数据: