1 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.
2 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).
3 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.
4 The quotaRPM must be installed to implement disk quotas.
Configuring Disk Quotas
To implement disk quotas, use the following steps:
1 Enable quotas per file system by modifying the /etc/fstabfile.
2 Remount the file system(s).
3 Create the quota database files and generate the disk usage table.
4. Assign quota policies.
Each of these steps is discussed in detail in the following sections.
Enabling Quotas
As root, using a text editor, edit the /etc/fstabfile. Add the usrquotaand/or grpquotaoptions to the file systems that require quotas:
In this example, the /homefile system has both user and group quotas enabled.
Creating the Quota Database Files
After each quota-enabled file system is remounted, the system is capable of working with disk quotas. However, the file system itself is not yet ready to support quotas. The next step is to run the quotacheckcommand.
The quotacheckcommand examines quota-enabled file systems and builds a table of the current disk usage per file system. The table is then used to update the operating system's copy of disk usage. In addition, the file system's disk quota files are updated.
To create the quota files (aquota.userand aquota.group) on the file system, use the -coption of the quotacheckcommand. For example, if user and group quotas are enabled for the /homefile system, create the files in the /homedirectory:
quotacheck -cug /home
The -coption specifies that the quota files should be created for each file system with quotas enabled, the -uoption specifies to check for user quotas, and the -goption specifies to check for group quotas.
If neither the -uor -goptions are specified, only the user quota file is created. If only -gis specified, only the group quota file is created.
After the files are created, run the following command to generate the table of current disk usage per file system with quotas enabled:
quotacheck -avug
The options used are as follows:
◦ a— Check all quota-enabled, locally-mounted file systems
◦ v— Display verbose status information as the quota check proceeds
◦ u— Check user disk quota information
◦ g— Check group disk quota information
After quotacheckhas finished running, the quota files corresponding to the enabled quotas (user and/or group) are populated with data for each quota-enabled locally-mounted file system such as /home.
Assigning Quotas per User
edquota username
Assigning Quotas per Group
quota -g devel
No comments