Sun Microsystems Logo
Products and Services
 
Support and Training
 
 

Previous Previous     Contents     Index     Next Next
Chapter 17

Managing Quotas (Tasks)

This chapter describes how to set up and administer quotas for disk space and inodes. This is a list of the step-by-step instructions in this chapter.

What Are Quotas?

Quotas enable system administrators to control the size of UFS file systems by limiting the amount of disk space and the number of inodes, which roughly corresponds to the number of files, that individual users can acquire. For this reason, quotas are especially useful on the file systems where user home directories reside. As a rule, public and /tmp file systems usually do not benefit as much from the establishment of quotas.

Using Quotas

Once quotas are in place, quotas can be changed to adjust the amount of disk space or number of inodes that users can consume. Additionally, quotas can be added or removed as system needs change. See Changing and Removing Quotas for instructions on changing quotas or the amount of time that quotas can be exceeded, disabling individual quotas, or removing quotas from file systems.

In addition, quota status can be monitored. Quota commands enable administrators to display information about quotas on a file system, or search for users who have exceeded their quotas. For procedures that describe how to use these commands, see Checking Quotas.

Setting Soft Limits and Hard Limits for Quotas

You can set both soft and hard limits. The system will not allow a user to exceed his or her hard limit. However, a system administrator might set a soft limit, which the user can temporarily exceed. The soft limit must be less than the hard limit.

Once the user exceeds the soft limit, a timer begins. While the timer is ticking, the user is allowed to operate above the soft limit but cannot exceed the hard limit. Once the user goes below the soft limit, the timer is reset. However, if the user's usage remains above the soft limit when the timer expires, the soft limit is enforced as a hard limit. By default, the soft limit timer is set to seven days.

The timeleft field in the repquota and quota commands shows the value of the timer.

For example, let's say a user has a soft limit of 10,000 blocks and a hard limit of 12,000 blocks. If the user's block usage exceeds 10,000 blocks and the seven-day timer is also exceeded, the user will not be able to allocate more disk blocks on that file system until his or her usage drops below the soft limit.

The Difference Between Disk Block and File Limits

A file system provides two resources to the user, blocks for data and inodes for files. Each file consumes one inode. File data is stored in data blocks, which are usually made up of 1 Kbyte blocks.

Assuming there are no directories, a user can exceed his or her inode quota by creating all empty files without using any blocks. A user can also use one inode yet exceed his or her block quota by creating one file large enough to consume all the data blocks in the user's quota.

Setting Up Quotas

Setting up quotas involves these general steps:

  1. Ensure that quotas are enforced each time the system is rebooted by adding an quota option to the /etc/vfstab file entries, and creating a quotas file in the top-level directory of the file system.

  2. After you create a quota for one user, you can copy the quota as a prototype to set up other user quotas.

  3. Before you turn quotas on, check the consistency of the proposed quotas with the current disk usage to make sure that there are no conflicts.

  4. Finally, turn the quotas on for one or more file systems.

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 17-1 Commands for Setting Up Quotas

Command

Task

Man Page

edquota

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

edquota(1M)

quotacheck

Examines each mounted UFS file system, comparing the file system's current disk usage against information stored in the file system's disk quota file, and resolves inconsistencies

quotacheck(1M)

quotaon

Activates the quotas for the specified file systems

quotaon(1M)

quota

Displays users' disk quotas on mounted file systems to verify that the quotas have been correctly set up

quota(1M)

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 that 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 user.

In environments where not all users are likely to push their limits, you might 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 user.

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.

Before you turn on the quotas, you must first configure the UFS file systems for the quotas, establish quotas for each user, and run the quotacheck command to check for consistency between current disk usage and quota files. Also, you should run the quotacheck command periodically if systems are rebooted infrequently.

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

Setting Up Quotas (Task Map)

Task

Description

For Instructions

1. Configure a file system for quotas

Edit the /etc/vfstab file so that quotas are activated each time the file system is mounted, and create a quotas file.

How to Configure File Systems for Quotas

2. Set up quotas for a user

Use the edquota command to create disk quotas and inode quotas for a single user account.

How to Set Up Quotas for a User

3. (Optional) Set up quotas for multiple users

Use the edquota command to apply prototype quotas to other user accounts.

How to Set Up Quotas for Multiple Users

4. Check for consistency

Use the quotacheck command to compare quotas to current disk usage for consistency across one or more file systems.

How to Check Quota Consistency

5. Turn on quotas

Use the quotaon command to initiate quotas on one or more file systems.

How to Turn On Quotas

Previous Previous     Contents     Index     Next Next