Contained Within
Find More Documentation
Featured Support Resources
| Descargar este libro en PDF
Managing Quotas
66
- 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.
-
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 contains procedures that describe how to configure file systems for quotas, and how to set up and activate quotas.
-
Table 66-1 describes the commands you use to set up disk quotas.
-
Table 66-1
| 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 reports on 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.
-
Table 66-2 Task Map: Setting Up Quotas
- Activity........Description
- For Instructions, Go To
-
Configure a File
- Edit /etc/vfstab so that quotas are activated each
-
· How to Configure page
-
System for Quotas
- time the file system is mounted, and create a quotas file.
-
File Systems for
-
1316
-
Quotas
-
Set Up Quotas for
- Use edquota to create disk and inode quotas for a single
-
-
Multiple Users
- other user accounts.
-
Prototype Quotas to
-
1318
-
Set Up Multiple Users
-
Check for
- Use quotacheck to compare quotas to current disk
-
· How to Check Quota page
-
Consistency
- usage for consistency on one or more file systems.
-
Consistency
-
1319
-
Initiate Quotas
- Use quotaon to initate quotas on one or more file
-
· How to Turn Quotas page
- systems.
-
On
-
1320
· How to Configure File Systems for Quotas
-
-
Become root.
-
Edit the /etc/vfstab file by using the editor of your choice. Enter rq in the mount options field for each UFS file system that will have quotas.
-
Exit the file, saving the changes.
-
Change directory to the top of the file system that will have quotas.
-
Create a file named quotas.
-
-
-
Change permissions to read/write for root only.
-
Example--Configuring File Systems for Quotas
- The following example of a line from /etc/vfstab shows that the directory /export/home from the system pluto is mounted as an NFS file system on mount point /usr/home. rq was entered in the mount options field, therefore quotas are activated each time this file system is rebooted.
-
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
pluto:/export/home - /usr/home nfs - yes rq
|
· How to Set Up Quotas for a User
-
-
Become root.
-
Use the quota editor to create a temporary file containing one line of quota information for each mounted file system that has a quotas file in its top-level directory.
-
- In this command,
-
username.......Is the user for whom you wish to set up quotas.
-
-
Change the number of 1-Kbyte disk blocks, both soft and hard, and the number of inodes, both soft and hard from 0 (the default) to the quotas you specify for each file system.
-
Exit the editor, saving your changes.
Verification--Setting Up Quotas for a User
- To verify that you have set up a user's quota, use the quota command.
-
- In this command,
-
| -v | Is the verbose option. |
| username | Is the user name whose quota you want to check. |
Examples--Setting Up Quotas for a User
- The 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.
-
fs /files blocks (soft = 0, hard = 0) inodes (soft = 0, hard = 0)
|
- The following example shows the same line in the temporary file after quotas have been set up.
-
fs /files blocks (soft = 50, hard = 60) inodes (soft = 90, hard = 100)
|
· How to Use Prototype Quotas to Set Up Multiple Users
-
-
Become root.
-
Use the quota editor to apply the quotas you already established for a prototype user to the additional users you specify.
-
# edquota -p prototype-user username1 [username2 username3 ...]
|
- In this command,
-
| prototype-user | Is the user name of the account for which you have set up quotas. |
| username1, 2, 3 ... | Specifies one or more user names of additional accounts. |
Example--Using Prototype Quotas to Set Up Multiple Users
- The following example applies the quotas established for user bob to users mary and john.
-
# edquota -p bob mary john
|
· How to Check Quota Consistency
-
Note - To ensure accurate disk data, the file systems being checked should be quiescent when you run the checkquota command. You could create a cron script to run checkquota during off hours. See cron(1M) for more information.
-
-
Become root.
-
Run a consistency check and assign correct initial values to file systems.
-
# quotacheck -v [-a | filesystem]
|
- In this command,
-
| -v | Is the verbose option. |
| -a | (Optional) Checks all file systems with an rq entry |
| filesystem | (Optional) Specifies a file system to check. |
Example--Checking Quota Consistency
- The following example checks quotas for the file system /usr on slice /dev/rdsk/c0t0d0s6. /usr is the only file system with an rq entry in /etc/vfstab.
-
# quotacheck -va
*** Checking quotas for /dev/rdsk/c0t0d0s6 (/usr)
|
· How to Turn Quotas On
-
-
Become root.
-
Turn file system quotas on by using the quotaon command.
-
# quotaon -v [-a | filesystem1 filesystem2 filesystem3 ...]
|
- In this command,
-
| -v | (Optional) Is the verbose option. |
| -a | (Optional) Turns quotas on for all file systems with an rq entry in the /etc/vfstab file. |
| filesystem1, 2, 3 ... | (Optional) Turns quotas on for one or more file systems that you specify. |
Example--Turning Quotas On
- The following example turns quotas on for /files on slice /dev/dsk/c0t4d0s2 and /snag on slice /dev/dsk/c0t3d0s2.
-
# quotaon -v /dev/dsk/c0t4d0s2 /dev/dsk/c0t3d0s2
/dev/dsk/c0t4d0s2: quotas turned on
/dev/dsk/c0t3d0s2: quotas turned on
|
Checking Quotas
- After 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.
-
Table 66-3 describes the commands you use to check quotas.
-
Table 66-3
| Command | Task |
| quota(1M) | Display user quotas and current disk use, and information about users who are exceeding their quotas. |
| repquota(1M) | Display quotas, files, and amount of space owned for specified file systems. |
· How to Check for Exceeded Quotas
- You can display the quotas and disk use for individual users on file systems on which quotas have been activated by using the quota command.
-
-
Become root.
-
Display user quotas for mounted file systems where quotas are enabled.
-
- In this command,
-
| -v | Displays users' quotas on all mounted file systems that have quotas. |
| username | (Optional) Is the name or UID of a user's account. |
Example--Checking for Exceeded Quotas
- The following example shows that the user account identified by UID 301 has a quota of one Kbyte but has not used any disk space.
-
# quota -v 301
Disk quotas for bob (uid 301):
Filesystem usage quota limit timeleft files quota limit timeleft
/usr 0 1 2 0 2 3
|
· How to Check Quotas on a File System
- Display the quotas and disk use for all users on one or more file systems by using the repquota command.
-
-
Become root.
-
Display all quotas for one or all file systems, even if there is no usage.
-
# repquota [-v /dev/dsk/devicename | -a]
|
- In this command,
-
| -v /dev/dsk/devicename | (Optional) Reports on the specified file system. |
| -a | (Optional) Reports on all file systems. |
Example--Checking Quotas on a File System
- The following example shows output from the repquota command on a system that has quotas enabled on only one file system (/usr).
-
# repquota -va
/dev/dsk/c0t0d0s6 (/usr):
Block limits File limits
User used soft hard timeleft used soft hard timeleft
#301 -- 0 1 2 0 2 3
#341 -- 0 1 2 0 2 3
|
Changing and Removing Quotas
- You can change quotas to adjust the amount of disk space or number of inodes that users can consume. Or you can remove quotas for individual users or from entire file systems as needed.
-
Table 66-4 describes the commands you use to change or remove quotas.
-
Table 66-4
| Command | Task |
| edquota(1M) | Change the hard and soft limits on the number of inodes or disk space for each user. Also, change the time period for each file system that its soft limits can be exceeded by any user. |
| quotaoff | Turn off quotas for specified file systems. See the quotaon(1M) man page for more information. |
· How to Change the Soft Time Limit Default
- Users 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.
-
-
Become root.
-
Use the quota editor to create a temporary file containing soft time limits.
-
-
-
Change the time limits from 0 (the default) to the time limits you specify by numbers and the keywords month, week, day, hour, min, or sec.
-
Exit the file, saving your changes.
Verification--Changing the Soft Time Limit Default
- To verify that a user's soft time limit has been correctly changed, use the quota command.
-
- In this command,
-
| -v | Is the verbose option. |
| username | Is the user name whose quota you want to check. |
Examples--Changing the Soft Time Limit Default
- The following example shows the contents of the temporary file opened by edquota on a system where /usr is the only mounted file system. The 0 (default) value means that the default time limit of one week is used.
-
fs /usr blocks time limit = 0 (default), files time limit = 0 (default)
|
- The following example shows the same temporary file after the time limit for exceeding the blocks quota has been changed to one week, and the time limit for exceeding the number of files has been changed to ten days.
-
fs /usr blocks time limit = 1 week, files time limit = 10 days
|
· How to Change Quotas for a User
-
-
Become root.
-
Use the quota editor to open a temporary file containing one line for each mounted file system that has a quotas file in its top-level directory.
-
- In this command,
-
username.......Is the user name whose quota will be disabled.
-
Note - Although you can specify multiple users as arguments to the edquota command, the information displayed does not show which user it belongs to, which could create some confusion.
-
-
Enter the number of 1-Kbyte disk blocks, both soft and hard, and the number of inodes, both soft and hard.
-
Exit the editor, saving your changes.
Verification--Changing Quotas for a User
- To verify that a user's quota has been correctly changed, use the quota command.
-
- In this command,
-
| -v | Is the verbose option. |
| username | Is the user name whose quota you want to check. |
Examples--Changing Quotas for a User
- The 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.
-
fs /files blocks (soft = 0, hard = 0) inodes (soft = 0, hard = 0)
|
- The following example shows the same temporary file after quotas have been changed.
-
fs /files blocks (soft = 0, hard = 0) inodes (soft = 0, hard = 0)
|
- 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.
-
# quota -v smith
Disk quotas for smith (uid 12):
Filesystem usage quota limit timeleft files quota limit timeleft
|
· How to Disable Quotas for a User
-
-
Become root.
-
Use the quota editor to create a temporary file containing one line for each mounted file system that has a quotas file in its top-level directory.
-
- In this command,
-
username.......Is the user name whose quota will be disabled.
-
Note - Although you can specify multiple users as arguments to the edquota command, the information displayed does not show which user it belongs with, which could create some confusion.
-
-
Change the number of 1-Kbyte disk blocks, both soft and hard, and the number of inodes, both soft and hard, to 0 (zero).
-
Note - Be sure you change the values to zero. Do not delete the line from the text file.
-
-
Exit the editor, saving your changes.
Verification--Disabling Quotas for a User
- To verify that you have disabled a user's quota, use the quota command.
-
- In this command,
-
-v...........Is the verbose option.
-
username........Is the user name UID whose quota you want to check.
Examples--Disabling Quotas for a User
- The 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.
-
fs /files blocks (soft = 50, hard = 60) inodes (soft = 90, hard = 100)
|
- The following example shows the same temporary file after quotas have been disabled.
-
fs /files blocks (soft = 0, hard = 0) inodes (soft = 0, hard = 10)
|
· How to Turn Quotas Off
-
-
Become root.
-
Turn file system quotas off.
-
# quotaoff [-v] [-a | filesystem1, filesystem2, filesystem3 ...]
|
- In this command,
-
| -v | Is the verbose option. |
| -a | (Optional) Turns quotas off for all file systems. |
| filesystem1, 2, 3 ... | (Optional) Turns quotas off for one or more file systems you specify. |
Example--Turning Quotas Off
- The following example turns the quotas off for the /usr file system.
-
# quotaoff -v /usr
/usr: quotas turned off
|
|
|