Chapter 9. Implementing Disk Quotas
quotaRPM must be installed to implement disk quotas.
9.1. Configuring Disk Quotas
- Enable quotas per file system by modifying the
- Remount the file system(s).
- Create the quota database files and generate the disk usage table.
- Assign quota policies.
9.1.1. Enabling Quotas
/etc/fstabfile. Add the
grpquotaoptions to the file systems that require quotas:
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1 LABEL=/boot /boot ext3 defaults 1 2 none /dev/pts devpts gid=5,mode=620 0 0 none /dev/shm tmpfs defaults 0 0 none /proc proc defaults 0 0 none /sys sysfs defaults 0 0 /dev/VolGroup00/LogVol02 /home ext3 defaults,usrquota,grpquota 1 2 /dev/VolGroup00/LogVol01 swap swap defaults 0 0 . . .
/homefile system has both user and group quotas enabled.
/homepartition was created during the installation of Red Hat Enterprise Linux. The root (
/) partition can be used for setting quota policies in the
9.1.2. Remounting the File Systems
grpquotaoptions, remount each file system whose
fstabentry has been modified. If the file system is not in use by any process, use one of the following methods:
- Issue the
umountcommand followed by the
mountcommand to remount the file system.(See the
manpage for both
mountfor the specific syntax for mounting and unmounting various filesystem types.)
- Issue the
mount -o remount <file-system>command (where
<file-system>is the name of the file system) to remount the file system. For example, to remount the
/homefile system, the command to issue is
mount -o remount /home.
9.1.3. Creating the Quota Database Files
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.
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
quotacheck -cug /home
-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.
-goptions are specified, only the user quota file is created. If only
-gis specified, only the group quota file is created.
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
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
9.1.4. Assigning Quotas per User
/dev/VolGroup00/LogVol02in the example below) and the command
edquota testuseris executed, the following is shown in the editor configured as the default for the system:
Disk quotas for user testuser (uid 501): Filesystem blocks soft hard inodes soft hard /dev/VolGroup00/LogVol02 440436 0 0 37418 0 0
EDITORenvironment variable is used by
edquota. To change the editor, set the
EDITORenvironment variable in your
~/.bash_profilefile to the full path of the editor of your choice.
inodescolumn shows how many inodes the user is currently using. The last two columns are used to set the soft and hard inode limits for the user on the file system.
Disk quotas for user testuser (uid 501): Filesystem blocks soft hard inodes soft hard /dev/VolGroup00/LogVol02 440436 500000 550000 37418 0 0
9.1.5. Assigning Quotas per Group
develgroup (the group must exist prior to setting the group quota), use the command:
edquota -g devel
Disk quotas for group devel (gid 505): Filesystem blocks soft hard inodes soft hard /dev/VolGroup00/LogVol02 440400 0 0 37418 0 0
quota -g devel
9.1.6. Setting the Grace Period for Soft Limits
edquotacommands operate on a particular user's or group's quota, the
-toption operates on every filesystem with quotas enabled.