Chapter 17. Disk Quotas
quotaRPM must be installed to implement disk quotas.
17.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.
17.1.1. Enabling Quotas
Example 17.1. Edit
vimtype the following:
# vim /etc/fstab
grpquotaoptions to the file systems that require quotas:
Example 17.2. Add 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
17.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. Refer to the
manpage for both
mountfor the specific syntax for mounting and unmounting various file system types.
- Issue the
mount -o remount file-systemcommand (where
file-systemis 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.
17.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.
quotacheckcommand has no effect on XFS as the table of disk usage is completed automatically at mount time. Refer to the man page
xfs_quota(8)for more information.
aquota.group) on the file system, use the
-coption of the
Example 17.3. Create Quota Files
/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.
- Check all quota-enabled, locally-mounted file systems
- Display verbose status information as the quota check proceeds
- Check user disk quota information
- 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
17.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.
Example 17.4. Change Desired Limits
Disk quotas for user testuser (uid 501): Filesystem blocks soft hard inodes soft hard /dev/VolGroup00/LogVol02 440436 500000 550000 37418 0 0
# quota username Disk quotas for user username (uid 501): Filesystem blocks quota limit grace files quota limit grace /dev/sdb 1000* 1000 1000 0 0 0
17.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
17.1.6. Setting the Grace Period for Soft Limits
edquotacommands operate on quotas for a particular user or group, the
-toption operates on every file system with quotas enabled.