Add section ID to ZFS Quotas so it can be referred to in Disk Quotas.

Editorial review of Disk Quotas.

Sponsored by:	iXsystems
This commit is contained in:
Dru Lavigne 2014-04-09 15:41:54 +00:00
parent 8af5d782d1
commit f223ab1430
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=44506
2 changed files with 68 additions and 78 deletions

View file

@ -2412,7 +2412,7 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
</sect1>
<sect1 xml:id="quotas">
<title>File System Quotas</title>
<title>Disk Quotas</title>
<indexterm>
<primary>accounting</primary>
@ -2420,32 +2420,35 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
</indexterm>
<indexterm><primary>disk quotas</primary></indexterm>
<para>Quotas are an optional feature of the operating system that
<para>Disk quotas
can be used to limit the amount of disk space or the number of
files a user or members of a group may allocate on a per-file
system basis. This is used most often on timesharing systems
where it is desirable to limit the amount of resources any one
user or group of users may allocate. This prevents one user or
system basis. This prevents one user or
group of users from consuming all of the available disk
space.</para>
<para>This section describes how to configure disk quotas for the
<acronym>UFS</acronym> file system. To configure quotas on the
<acronym>ZFS</acronym> file system, refer to <xref
linkend="zfs-quotas"/></para>
<sect2>
<title>Configuring the System to Enable Disk Quotas</title>
<title>Enabling Disk Quotas</title>
<para>Before using disk quotas, quota support must be added to
the kernel by adding the following line to the kernel
configuration file:</para>
<para>To determine if the &os; kernel provides support for disk
quotas:</para>
<screen>&prompt.user; <userinput>sysctl kern.features.ufs_quota</userinput>
kern.features.ufs_quota: 1</screen>
<para>In this example, the <literal>1</literal> indicates quota
support. If the value is instead <literal>0</literal>,
add the following line to a custom kernel configuration file
and rebuild the kernel using the instructions in <xref
linkend="kernelconfig"/>:</para>
<programlisting>options QUOTA</programlisting>
<para>Before &os;&nbsp;9.2, the <filename>GENERIC</filename>
kernel usually did not include this option.
<command>sysctl kern.features.ufs_quota</command> can be used
to test whether the current kernel supports quotas. If the
option is not present, a custom kernel must be compiled.
Refer to <xref linkend="kernelconfig"/> for more information
on kernel configuration.</para>
<para>Next, enable disk quotas in
<filename>/etc/rc.conf</filename>:</para>
@ -2455,8 +2458,7 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
<primary>disk quotas</primary>
<secondary>checking</secondary>
</indexterm>
<para>For finer control over quota startup, an additional
configuration variable is available. Normally on bootup, the
<para>Normally on bootup, the
quota integrity of each file system is checked by
&man.quotacheck.8;. This program insures that the data in the
quota database properly reflects the data on the file system.
@ -2467,41 +2469,35 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
<programlisting>check_quotas="NO"</programlisting>
<para>Finally, edit <filename>/etc/fstab</filename> to enable
disk quotas on a per-file system basis. This is when user or
group quotas can be enabled on the file systems.</para>
<para>To enable per-user quotas on a file system, add
disk quotas on a per-file system basis. To enable per-user quotas on a file system, add
<option>userquota</option> to the options field in the
<filename>/etc/fstab</filename> entry for the file system to
enable quotas on. For example:</para>
<programlisting>/dev/da1s2g /home ufs rw,userquota 1 2</programlisting>
<para>To enable group quotas, instead use
<option>groupquota</option>. To enable both user and group
quotas, change the entry as follows:</para>
<para>To enable group quotas, use
<option>groupquota</option> instead. To enable both user and group
quotas, separate the options with a comma:</para>
<programlisting>/dev/da1s2g /home ufs rw,userquota,groupquota 1 2</programlisting>
<para>By default, the quota files are stored in the root
<para>By default, quota files are stored in the root
directory of the file system as
<filename>quota.user</filename> and
<filename>quota.group</filename>. Refer to &man.fstab.5; for
more information. Even though an alternate location for the
quota files can be specified, this is not recommended because
the various quota utilities do not seem to handle this
properly.</para>
more information. Specifying an alternate location for the
quota files is not recommended.</para>
<para>Once the configuration is complete, reboot the system
with the new kernel. <filename>/etc/rc</filename> will
<para>Once the configuration is complete, reboot the system and
<filename>/etc/rc</filename> will
automatically run the appropriate commands to create the
initial quota files for all of the quotas enabled in
<filename>/etc/fstab</filename>. There is no need to
manually create any zero length quota files.</para>
<filename>/etc/fstab</filename>.</para>
<para>In the normal course of operations, there should be no
need to manually run &man.quotacheck.8;, &man.quotaon.8;, or
&man.quotaoff.8;. However, one should read their manual pages
&man.quotaoff.8;. However, one should read these manual pages
to be familiar with their operation.</para>
</sect2>
@ -2513,8 +2509,8 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
<secondary>limits</secondary>
</indexterm>
<para>Once the system has been configured to enable quotas,
verify they really are enabled by running:</para>
<para>To
verify that quotas are enabled, run:</para>
<screen>&prompt.root; <userinput>quota -v</userinput></screen>
@ -2523,13 +2519,13 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
enabled on.</para>
<para>The system is now ready to be assigned quota limits with
&man.edquota.8;.</para>
<command>edquota</command>.</para>
<para>Several options are available to enforce limits on the
amount of disk space a user or group may allocate, and how
many files they may create. Allocations can be limited based
on disk space (block quotas), number of files (inode quotas),
or a combination of both. Each limits is further broken down
or a combination of both. Each limit is further broken down
into two categories: hard and soft limits.</para>
<indexterm><primary>hard limit</primary></indexterm>
@ -2549,31 +2545,27 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
are allowed. When the user drops back below the soft limit,
the grace period is reset.</para>
<para>The following is an example output from &man.edquota.8;.
When &man.edquota.8; is invoked, the editor specified by
<para>In the following example, the quota for the
<systemitem class="username">test</systemitem> account is being edited.
When <command>edquota</command> is invoked, the editor specified by
<envar>EDITOR</envar> is opened in order to edit the quota
limits. The default editor is set to
<application>vi</application>.</para>
<screen>&prompt.root; <userinput>edquota -u test</userinput></screen>
<programlisting>Quotas for user test:
<screen>&prompt.root; <userinput>edquota -u test</userinput>
Quotas for user test:
/usr: kbytes in use: 65, limits (soft = 50, hard = 75)
inodes in use: 7, limits (soft = 50, hard = 60)
/usr/var: kbytes in use: 0, limits (soft = 50, hard = 75)
inodes in use: 0, limits (soft = 50, hard = 60)</programlisting>
inodes in use: 0, limits (soft = 50, hard = 60)</screen>
<para>There are normally two lines for each file system that
has quotas enabled. One line represents the block limits and
the other represents the inode limits. Change the value to
modify the quota limit. For example, to raise this
user's block limit from a soft limit of 50 and a hard limit of
75 to a soft limit of 500 and a hard limit of 600,
change:</para>
<programlisting>/usr: kbytes in use: 65, limits (soft = 50, hard = 75)</programlisting>
<para>to:</para>
modify the quota limit. For example, to raise the
block limit on <filename>/usr</filename>
to a soft limit of <literal>500</literal> and a hard limit of <literal>600</literal>,
change the values in that line as follows:</para>
<programlisting>/usr: kbytes in use: 65, limits (soft = 500, hard = 600)</programlisting>
@ -2581,13 +2573,13 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
editor.</para>
<para>Sometimes it is desirable to set quota limits on a range
of UIDs. This can be done by passing <option>-p</option> to
&man.edquota.8;. First, assign the desired quota limit to a
user, then run
<command>edquota -p protouser startuid-enduid</command>. For
example, if <systemitem class="username">test</systemitem> has
the desired quota limits, the following command will duplicate
those quota limits for UIDs 10,000 through 19,999:</para>
of users. This can be done by first assigning the desired quota limit to a
user. Then, use <option>-p</option> to duplicate that quota
to a specified range of user IDs (<acronym>UID</acronym>s).
The following command will duplicate
those quota limits for <acronym>UID</acronym>s
<literal>10,000</literal> through
<literal>19,999</literal>:</para>
<screen>&prompt.root; <userinput>edquota -p test 10000-19999</userinput></screen>
@ -2602,8 +2594,7 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
<secondary>checking</secondary>
</indexterm>
<para>Either &man.quota.1; or &man.repquota.8; can be used to
check quota limits and disk usage. To check individual user
<para>To check individual user
or group quotas and disk usage, use &man.quota.1;. A user
may only examine their own quota and the quota of a group they
are a member of. Only the superuser may view all user and
@ -2611,7 +2602,11 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
for file systems with quotas enabled, use
&man.repquota.8;.</para>
<para>The following is sample output from
<para>Normally, file systems that the user is not using any disk
space on will not show in the output of <command>quota</command>, even if
the user has a quota limit assigned for that file system. Use
<option>-v</option> to display those file systems. The
following is sample output from
<command>quota -v</command> for a user that has quota limits
on two file systems.</para>
@ -2627,13 +2622,6 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
days of grace period left. The asterisk <literal>*</literal>
indicates that the user is currently over the quota
limit.</para>
<para>Normally, file systems that the user is not using any disk
space on will not show in the output of &man.quota.1;, even if
the user has a quota limit assigned for that file system. Use
<option>-v</option> to display those file systems, such as
<filename>/usr/var</filename> in the above
example.</para>
</sect2>
<sect2>
@ -2641,18 +2629,20 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on
<indexterm><primary>NFS</primary></indexterm>
<para>Quotas are enforced by the quota subsystem on the NFS
<para>Quotas are enforced by the quota subsystem on the <acronym>NFS</acronym>
server. The &man.rpc.rquotad.8; daemon makes quota
information available to &man.quota.1; on NFS clients,
information available to <command>quota</command> on <acronym>NFS</acronym> clients,
allowing users on those machines to see their quota
statistics.</para>
<para>Enable <command>rpc.rquotad</command> in
<filename>/etc/inetd.conf</filename> like so:</para>
<para>On the <acronym>NFS</acronym> server, enable
<command>rpc.rquotad</command> by removing the
<literal>#</literal> from this line in
<filename>/etc/inetd.conf</filename>:</para>
<programlisting>rquotad/1 dgram rpc/udp wait root /usr/libexec/rpc.rquotad rpc.rquotad</programlisting>
<para>Now restart <command>inetd</command>:</para>
<para>Then, restart <command>inetd</command>:</para>
<screen>&prompt.root; <userinput>service inetd restart</userinput></screen>
</sect2>

View file

@ -545,7 +545,7 @@ errors: No known data errors</screen>
<acronym>ZFS</acronym> options.</para>
</sect3>
<sect3>
<sect3 xml:id="zfs-quotas">
<title>ZFS Quotas</title>
<para>ZFS supports different types of quotas: the refquota,