System Administration Guide, Volume 2

Setting Up Quotas

You can set up quotas to limit the amount of disk space and number of inodes (roughly equivalent to the number of files) available to users. These quotas are activated automatically each time a file system is mounted. This section describes how to configure file systems for quotas, and how to set up and activate quotas.

Setting up quotas involves these general steps:

  1. A series of commands prepares a file system to accept quotas, ensuring that quotas will be enforced each time the system is rebooted and the file system is mounted. Entries must be added to the /etc/vfstab file, and a quotas file must be created in the top-level directory of the file system.

  2. After a quota is created for one user, it can be copied as a prototype to set up other user quotas.

  3. Before quotas are actually turned on, another command checks for consistency by comparing the proposed quotas with the current disk usage to make sure that there are no conflicts.

  4. Finally, a command turns the quotas on for one or more entire file systems.

These steps ensure that quotas are automatically activated on a file system each time it is mounted. For specific information about these procedures, see "Setting Up Quotas Task Map".

The following table describes the commands you use to set up disk quotas.

Table 29-1 Commands for Setting Up Quotas

Command 

Enables You To ... 

edquota(1M)

Set the hard and soft limits on the number of inodes and disk space for each user  

quotacheck(1M)

Examine each mounted UFS file system, comparing against information stored in the file system's disk quota file, and resolve inconsistencies 

quotaon(1M)

Activate the quotas for the specified file systems 

quota(1M)

Display user's quotas on mounted file systems to verify that quotas have been correctly set up 

Guidelines for Setting Up Quotas

Before you set up quotas, you need to determine how much space and how many inodes to allocate to each user. If you want to be sure the total file system space is never exceeded, you can divide the total size of the file system between the number of users. For example, if three users share a 100-Mbyte slice and have equal disk space needs, you could allocate 33 Mbytes to each. In environments where not all users are likely to push their limits, you may want to set individual quotas so that they add up to more than the total size of the file system. For example, if three users share a 100-Mbyte slice, you could allocate 40 Mbytes to each.

When you have established a quota for one user by using the edquota command, you can use this quota as a prototype to set the same quota for other users on the same file system.

After you have configured UFS file systems for quotas and established quotas for each user, run the quotacheck command to check consistency between current disk usage and quota files before you actually turn quotas on. Also, if systems are rebooted infrequently, it is a good idea to periodically run quotacheck.

The quotas you set up with edquota are not enforced until you turn them on by using the quotaon command. If you have properly configured the quota files, quotas will be turned on automatically each time a system is rebooted and the file system is mounted.