Language and Page Formatting Options
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
Procedure 17.1. Enabling Quotas
- Log in as root.
- Edit the
- Add either the
grpquotaor both options to the file systems that require quotas.
Example 17.1. Edit
vimtype the following:
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
grpquotaor both options, 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:
- Run 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 file system types.
- Run 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, run the
mount -o remount /homecommand.
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. See the man page
xfs_quota(8)for more information.
Procedure 17.2. Creating the Quota Database Files
- Create the quota files on the file system using the following command:
quotacheck -cug /file system
- Generate the table of current disk usage per file system using the following command:
- Specifies that the quota files should be created for each file system with quotas enable.
- Checks for user quotas.
- Checks for group quotas. If only
-gis specified, only the group quota file is created.
-goptions are specified, only the user 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 (either user or group or both) are populated with data for each quota-enabled locally-mounted file system such as
17.1.4. Assigning Quotas per User
- User must exist prior to setting the user quota.
Procedure 17.3. Assigning Quotas per User
- To assign the quota for a user, use the following command:
edquota usernameReplace username with the user to which you want to assign the quotas.
- To verify that the quota for the user has been set, use the following command:
Example 17.3. Assigning Quotas to a user
/dev/VolGroup00/LogVol02in the following example) 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 testuserDisk 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
- Group must exist prior to setting the group quota.
Procedure 17.4. Assigning Quotas per Group
- To set a group quota, use the following command:
edquota -g groupname
- To verify that the group quota is set, use the following command:
quota -g groupname
Example 17.5. Assigning quotas to group
develgroup, 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.