logo
OpenSource Apache Embedded?C Linux MySQL No deposit no GamStop bonuses Perl PHP Samba

Module Release April 2003: Disk Quotas

This month's offering is primarily about limiting user access to file system resources using quotas.

LPI?101 objective?2.4.4 requires you to:

Setup disk quota for a filesystem, edit user quota, check user quota, generate reports of user quota. Includes quota, edquota, repquota, quotaon commands.

In practice Linux quotas merely limit users available disk space. In Linux, quotas do not limit users access to other system resources like memory. If you need to limit memory resources, use the shell builtin command ulimit and related tools like getrlimit, setrlimit, and sysconf.

Using quotas is unnecessarily hard, but fortunately only a minority of users will need them. Quotas are typically required on systems with large numbers of ?untrusted? or external users, to prevent individuals or groups from denying disk space to other users or to prevent them interfering with the proper functioning of the system. In many other circumstances, user education and cheap hard disk space may be adequate.

The disk space limits set by quotas can be ?hard? or ?soft?. Hard limits simply cannot be exceeded. Exceeding a soft limit will produce a warning which will indicate the temporary ?grace period? for which excessive usage may be allowed.

Most quotas are set on a per-user basis, but they can be applied to groups where any group member's excess usage will deny space to the entire group. Limits can be set on the number of blocks or inodes that can be used.

The quota command displays the limits set for named users or groups. The filesystems on which quotas apply are set in the filesystem table (/etc/fstab). The commands quota on and quotaoff turn quotas on or off, as one would expect. The setquota command specifies the actual limits for named users and groups, but its options must be specified in a precise order. Setting any limit to zero removes that limit. Finally, the edquota command allows you to edit quotas interactively with your favourite text editor. Be aware, however, that edquota is known to be broken in some older versions of the most popular commercial Linux distribution.