[Next] [Previous] [Up] [Top] [Contents]

CHAPTER 5 File System Management

5.8 File System Quotas


File System quotas are used to control disk space. This allows you to prevent users from monopolizing the disk space. For SunOS 4.1.X to run quotas you need first to provide the support in the kernel. This is done with the line:

options QUOTA

in the configuration file. Quotas are only supported on locally mounted disks; quotas will work on NFS mounted file systems, but soft-limit warnings may not always be given. The file should be mounted with the quota option, e.g. in /etc/fstab there might be a line similar to:

/dev/sd0h /home 4.2 rw,quota 1 2

A file named quotas must be set up at the root directory of each file system for which you wish to have quotas. This is a binary file that can be edited with edquota. It should be owned by root with no access for other users, e.g.:

# touch /home/quotas

# chmod 600 /home/quotas

The script /etc/rc checks for quota consistency under SunOS 4.1.X with the command quotacheck, which examines the disk usage on each file system against the disk quota file. This should be run on quiescent file systems (preferably unmounted). /etc/rc then turns the quotas on for each file system with quotaon. This must be run on mounted file systems.

Quotas can be set for each user independently, and can be by either blocks or inodes. The former limits the amount of disk space available for the user, while the latter limits the number of files that the user can have. To set/change a user's limits use the edquota program. e.g. "edquota username". This creates an ASCII file of the current disk quotas for that user and then invokes an editor. After modifying the quotas you leave the editor and edquota takes this temporary file and merges it with the binary quota file.

The ASCII version of the quotas file might look something like:

fs /home blocks (soft = 4000, hard = 5000) inodes (soft = 0, hard = 0)

where a "0" means there is no limit.

To check disk usage on a file system you can use the quot command, e.g.:

# quot /dev/rsd0h

/dev/rsd0h:
97558 chohan
48915 root
41465 anup
31227 frank
14454 bobd
10301 jeffs
9051 kalal


Unix System Administration - 8 AUG 1996
[Next] [Previous] [Up] [Top] [Contents]