Quotas





Disk space can be restricted by implementing disk quotas which alert a system administrator before a user consumes too much disk space or a partition becomes full. 

Disk quotas can be configured for individual users as well as user groups. This makes it possible to manage the space allocated for user-specific files (such as email) separately from the space allocated to the projects a user works on (assuming the projects are given their own groups). 

In addition, quotas can be set not just to control the number of disk blocks consumed but to control the number of inodes (data structures that contain information about files in UNIX file systems). Because inodes are used to contain file-related information, this allows control over the number of files that can be created. 

Quota Tools

Quota checks can be implemented on the file system of a hard disk partition mounted on your system. The quotas are enabled using the quotacheck and quotaon programs. They
are executed in the /etc/rc.d/rc.sysinit script, which is run whenever you start up your system. Each partition needs to be mounted with the quota options, usrquota or grpquota. usrquota enables quota controls for users, and grpquota works for groups.
 

These options are usually placed in the mount entry in the /etc/fstab file for a particular
partition. For example, to mount the /dev/hda6 hard disk partition mounted to the /home
directory with support for user and group quotas, you require a mount entry like the following:
 

/dev/hda6 /home ext2 defaults,usrquota,grpquota 1 1
 
You also need to create quota.user and quota.group files for each partition for which you enable quotas. These are the quota databases that hold the quota information for each
user and group. You can create these files by running the quotacheck command with the -a option or the device name of the file system where you want to enable quotas. The
following example creates the quota database on the hda1 hard disk partition:


quotacheck -a /dev/hda1

 

edquota

You can set disk quotas using the edquota command. With it, you can access the quota record for a particular user and group, which is maintained in the disk quota database. You
can also set default quotas that will be applied to any user or group on the file system for which quotas have not been set. edquota will open the record in your default editor, and
you can use your editor to make any changes. To open the record for a particular user, use the -u option and the username as an argument for edquota. The following example opens the disk quota record for the user helpdesk:
 

edquota -u helpdesk




The limit you set for a quota can be hard or soft.


  • Hard Limit : A hard limit will deny a user the ability
    to exceed his or her quota
  • Soft Limit : Soft limit will just issue a warning.