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. | |
2. Set up quotas for a user |
Use the edquota command to create disk quotas and inode quotas for a single user account. | |
3. (Optional) Set up quotas for multiple users |
Use the edquota command to apply prototype quotas to other user accounts. | |
4. Check for consistency |
Use the quotacheck command to compare quotas to current disk usage for consistency across one or more file systems. | |
5. Turn on quotas |
Use the quotaon command to initiate quotas on one or more file systems. |
Edit the /etc/vfstab file and add rq to the mount options field for each UFS file system that will have quotas.
Change directory to the root of the file system that will have quotas.
# touch quotas |
Change permissions to read/write for root access only.
# chmod 600 quotas |
Use the following table to determine which tasks to complete next.
Task |
For More Information |
---|---|
Set up quotas for a user or multiple users. | |
If you are setting up quotas on a file system with existing files, you need to run the quotacheck command. | |
Turn on file system quotas. |
The following /etc/vfstab example shows that the /export/home directory from the system pluto is mounted as an NFS file system on the local system. You can tell quotas are enabled by the rq entry under the mount options column.
#device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # pluto:/export/home - /export/home nfs - yes rq |
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.
#device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # /dev/dsk/c0t4d0s0 /dev/rdsk/c0t4d0s0 /work ufs 3 yes rq |
Use the quota editor to create a temporary file that contains one line of quota information for each mounted UFS file system that has a quotas file in the file system's root directory.
# edquota username |
Where username is the user for whom you want 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.
Verify the user's quota.
# quota -v username |
-v |
Displays the user's quota information on all mounted file systems where quotas exist. |
username |
Specifies the user name to view quota limits. |
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 the root 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) |
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 username ... |
prototype-user |
User name of the account for which you have set up quotas. |
username ... |
Specifies one or more user names of additional accounts. |
The following example shows how to apply the quotas established for user bob to users mary and john.
# edquota -p bob mary john |
The quotacheck command is run automatically when a system is rebooted. You generally do not have to run the quotacheck command on an empty file system with quotas. However, if you are setting up quotas on an file system with existing files, you need to run the quotacheck command to synchronize the quota database with the files or inodes that already exist in the file system.
Also keep in mind that running the quotacheck command on large file systems can be time-consuming.
To ensure accurate disk data, the file systems being checked should be quiescent when you run the quotacheck command manually.
Run a consistency check on UFS file systems.
# quotacheck [-va] filesystem |
-v |
(Optional) Identifies the disk quotas for each user on a particular file system. |
-a |
Checks all file systems with an rq entry in the /etc/vfstab file. |
filesystem |
Specifies the file system to check. |
See quotacheck(1M) for more information.
The following example shows how to check 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.
# quotacheck -va *** Checking quotas for /dev/rdsk/c0t0d0s7 (/export/home) |
Turn on file system quotas.
# quotaon [-v] -a filesystem ... |
-v |
Displays a message for each file system after quotas are turned on. |
-a |
Turns on quotas for all file systems with an rq entry in the /etc/vfstab file. |
filesystem ... |
Turns on quotas for one or more file systems that you specify. More than one file system is specified by separating each file system name with a space. |
The following example shows how to turn quotas on for the file systems on the /dev/dsk/c0t4d0s7 and /dev/dsk/c0t3d0s7 slices.
# quotaon -v /dev/dsk/c0t4d0s7 /dev/dsk/c0t3d0s7 /dev/dsk/c0t4d0s7: quotas turned on /dev/dsk/c0t3d0s7: quotas turned on |