Содержащиеся вНайти другие документыРесурсы поддержки | Загрузить это руководство в формате PDF (1611 КБ)
Chapter 29 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. Using QuotasUsing 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. Once they 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". Soft Limits and Hard LimitsYou 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 may set a soft limit (sometimes referred to as a quota) which can be temporarily exceeded by the user. 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 gets 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 seven days. The value of the timer is shown by the timeleft field in the repquota and quota commands. 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 timer is also exceeded (more than seven days), 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. Difference Between Disk Block and File LimitsThere are two resources that a file system provides to the user: blocks (for data) and inodes (for files). Each file consumes one inode. File data is stored in data blocks (usually made of up 1 kilobyte blocks.) Assuming there are no directories, it is possible for a user to exceed his or her inode quota without using any blocks by creating all empty files. It is also possible for a user to use only one inode yet exceed his or her block quota by simply creating one file large enough to consume all the data blocks in the user's quota. Setting Up QuotasYou 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:
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
Guidelines for Setting Up QuotasBefore 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. Setting Up Quotas Task MapTable 29-2 Setting Up Quotas Task Map
How to Configure File Systems for Quotas
Examples--Configuring File Systems for QuotasThe following example from /etc/vfstab shows that the /export/home directory from the system pluto is mounted as an NFS file system on the local system with quotas enabled, signified by the rq entry under the mount options column.
The following example line from /etc/vfstab shows that the local /work directory is mounted with quotas enabled, signified by the rq entry under the mount options column.
How to Set Up Quotas for a User
Examples--Setting Up Quotas for a UserThe following example shows the contents of the temporary file opened by edquota on a system where /files is the only mounted file system containing a quotas file in its top-level directory.
The following example shows the same line in the temporary file after quotas have been set up.
How to Set Up Quotas for Multiple Users
Example--Setting Up Prototype Quotas for Multiple UsersThe following example applies the quotas established for user bob to users mary and john.
How to Check Quota ConsistencyNote - To ensure accurate disk data, the file systems being checked should be quiescent when you run the quotacheck command manually. The quotacheck command is run automatically when a system is rebooted.
Example--Checking Quota ConsistencyThe following example checks quotas for the /export/home file system on the /dev/rdsk/c0t0d0s7 slice. The /export/home file system is the only file system with an rq entry in the /etc/vfstab file.
How to Turn Quotas On
Example--Turning Quotas OnThe following example turns quotas on for the file systems on the /dev/dsk/c0t4d0s7 and /dev/dsk/c0t3d0s7 slices.
Checking QuotasAfter you have set up and turned on disk and inode quotas, you can check for users who exceed their quotas. In addition, you can check quota information for entire file systems. The table below describes the commands you use to check quotas. Table 29-3 Commands for Checking Quotas
How to Check for Exceeded QuotasYou can display the quotas and disk use for individual users on file systems on which quotas have been activated by using the quota command.
Example--Checking for Exceeded QuotasThe following example shows that the user account identified by UID 301 has a quota of one Kbyte but has not used any disk space.
How to Check Quotas on a File SystemDisplay the quotas and disk use for all users on one or more file systems by using the repquota command.
Example--Checking Quotas on a File SystemThe following example shows output from the repquota command on a system that has quotas enabled on only one file system (/export/home).
Changing and Removing QuotasYou can change quotas to adjust the amount of disk space or number of inodes users can consume. You can also remove quotas for individual users or from entire file systems as needed. The following table describes the commands you use to change or remove quotas. Table 29-4 Commands for Changing and Removing Quotas
How to Change the Soft Time Limit DefaultUsers can exceed the soft time limits for their quotas for one week, by default. This means that after a week of repeated violations of the soft time limits of either disk space or inode quotas, the system prevents users from using any more inodes or disk blocks. You can change the length of time that users may exceed their disk space or inode quotas by using the edquota command.
Examples--Changing the Soft Time Limit DefaultThe following example shows the contents of the temporary file opened by edquota on a system where /export/home is the only mounted file system with quotas. The 0 (default) value means that the default time limit of one week is used.
The following example shows the same temporary file after the time limit for exceeding the blocks quota has been changed to two weeks, and the time limit for exceeding the number of files has been changed to 16 days.
How to Change Quotas for a User
Examples--Changing Quotas for a UserThe following example shows the contents of the temporary file opened by edquota on a system where /files is the only mounted file system containing a quotas file in its top-level directory.
The following example shows the same temporary file after quotas have been changed.
The following example shows how to verify that the hard quotas for user smith have been changed to 500 1-Kbyte blocks, and 100 inodes.
How to Disable Quotas for a User
Examples--Disabling Quotas for a UserThe following example shows the contents of the temporary file opened by edquota on a system where /files is the only mounted file system containing a quotas file in its top-level directory.
The following example shows the same temporary file after quotas have been disabled.
How to Turn Quotas Off
Example--Turning Quotas OffThe following example turns the quotas off for the /export/home file system.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||