7.1. Introduction to Disk Quotas

On a system with multiple users, it is often necessary to limit how much disk space each user can take up. Quotas are the mechanism used by UNIX systems to enforce limits on the amount of disk space and the number of files each user (and possibly group) can own. Each file counts towards the quota of the user who owns it, and if group quotas are being used the file counts towards the quotas of its group owner as well. Once a user exceeds his quota, he will not be able to create or enlarge any files until some are deleted.

Quotas are set up on a per-filesystem basis, so that you can have different quotas for different directories on your system. This means, however, that if two directories are both on the same filesystem then they must share the same quotas. Only UNIX filesystems like ext2, ext3, and xfs on local hard disks support quotas—although if your system NFS mounts a remote directory that has quotas enabled, they will be enforced on the server.

Each user or group has two different quotas, one for blocks and one for files. The blocks quota controls how much disk space the user can use and is specified in disk blocks that are typically 1 kB in size. The files quota controls how many separate files the user can create, and is necessary because UNIX filesystems often have a limit on how many files can exist at one time. Without a files quota, a user could create millions of empty files until the filesystems limit was reached and so prevent other users from creating any files at all.

Both the blocks and files quotas have what are called soft and hard limits. The soft limit is the point at which the user is warned that he is close to exceeding his quota, but is still allowed to continue using up disk space. The hard limit is the number of blocks or files that can never be exceeded, and any attempt to do so will result in an error. Both limits are optional, so that you can have only a hard limit and give the user no warning that he is approaching his quota, or only a soft limit and only warn users of quota violations instead of actually enforcing them.

If a user stays above his soft limit but below the hard limit for more than a set period of time (called the grace period), the system will treat him as though he has exceeded the hard limit and prevent the creation or enlargement of any files. Only when the user deletes enough files to drop his usage below the soft limit will it revert to just a warning level.

At the shell prompt, quotas can be viewed using the repquota and quota commands, and edited using the edquota command. The files aquota.user and aquota.group in the mount directory of each filesystem contain the actual records of how much disk space is allocated to each user or group and how much they are currently using. When displaying and setting quotas, Webmin calls the quota commands and parses their output. It does not use system calls or attempt to edit the quota files directly.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.212.54