2.  Administering the quota system

      To set up and establish the disc quota system, there are several steps necessary to be performed by the system administrator.

      First, the system must be configured to include the disc quota sub-system. This is done by including the line:

options   QUOTA
in the system configuration file, then running config(8) followed by a system configuration*.

      Second, a decision as to what filesystems need to have quotas applied needs to be made. Usually, only filesystems that house users' home directories, or other user files, will need to be subjected to the quota system, though it may also prove useful to also include /usr. If possible, /tmp should usually be free of quotas.

      Having decided on which filesystems quotas need to be set upon, the administrator should then allocate the available space amongst the competing needs. How this should be done is (way) beyond the scope of this document.

      Then, the edquota(8) command can be used to actually set the limits desired upon each user. Where a number of users are to be given the same quotas (a common occurrence) the -p switch to edquota will allow this to be easily accomplished.

      Once the quotas are set, ready to operate, the system must be informed to enforce quotas on the desired filesystems. This is accomplished with the quotaon(8) command. Quotaon will either enable quotas for a particular filesystem, or with the -a switch, will enable quotas for each filesystem indicated in /etc/fstab as using quotas. See fstab(5) for details. Most sites using the quota system, will include the line

/etc/quotaon -a
in /etc/rc.local.

      Should quotas need to be disabled, the quotaoff(8) command will do that, however, should the filesystem be about to be dismounted, the umount(8) command will disable quotas immediately before the filesystem is unmounted. This is actually an effect of the umount(2) system call, and it guarantees that the quota system will not be disabled if the umount would fail because the filesystem is not idle.

      Periodically (certainly after each reboot, and when quotas are first enabled for a filesystem), the records retained in the quota file should be checked for consistency with the actual number of blocks and files allocated to the user. The quotacheck(8) command can be used to accomplish this. It is not necessary to dismount the filesystem, or disable the quota system to run this command, though on active filesystems inaccurate results may occur. This does no real harm in most cases, another run of quotacheck when the filesystem is idle will certainly correct any inaccuracy.

      The super-user may use the quota(1) command to examine the usage and quotas of any user, and the repquota(8) command may be used to check the usages and limits for all users on a filesystem.