Linux online course

Set User and Group Disk Quotas with edquota in Linux

Learn how to edit Linux user and group disk quotas with edquota, including block limits, inode limits, grace periods, validation, and troubleshooting.

A disk quota is a filesystem policy that restricts how much storage or how many filesystem objects a user or group may consume. Linux quota administration commonly uses edquota to edit these limits.

This lesson focuses on editing quotas after quota support has already been enabled and activated on the target filesystem. Quotas do not apply automatically to every mounted filesystem.

What Disk Quotas Control

A quota-enabled filesystem can limit two different resources:

  • Storage space: measured by blocks reported by the quota tools. This controls allocated disk space.
  • File count: measured by inodes. This controls how many files and directories a user or group can own.

An inode is filesystem metadata representing an object such as a file or directory. An inode quota is useful when a user creates many small files: the filesystem may still have free space, but the user can be prevented from creating another object after reaching the inode limit.

Quotas apply only to a quota-enabled filesystem—a mounted filesystem configured to account for and enforce user and/or group quotas.

For background on mounted storage and ownership, see the Linux file structure and managing file ownership.

Prerequisites Before Editing Quotas

Before running edquota, identify:

  • The target user or Unix group.
  • The filesystem containing the user's or group's files.
  • The mount point and device associated with that filesystem.
  • Whether user quotas, group quotas, or both are enabled.

The filesystem must be mounted with the appropriate user and/or group quota support. Quota accounting data must also have been initialized, and quota enforcement must be active. The exact mount options, initialization commands, and quota metadata depend on the Linux distribution and filesystem type, so follow the procedure appropriate to that environment rather than assuming one universal configuration.

Administrative privileges are required to change quota settings. Use a root shell or prefix the administration commands with sudo. If the quota tools are unavailable, install the quota administration package supplied by the distribution.

Inspect a User Quota with edquota

The basic command for editing an individual user's quota is:

sudo edquota USER_NAME

For example, to edit the quota record for the user bob:

sudo edquota bob

edquota opens the selected user's quota record in the text editor configured for the administrative environment. Depending on the system, this may be vi, vim, nano, or another editor.

A typical record resembles the following. The exact headings and displayed units vary by quota tools and filesystem configuration.

Filesystem   blocks   soft   hard   inodes   soft   hard
/dev/sdc1       4       0      0       120      0      0

Some systems display additional grace-period information or use a mounted filesystem path instead of a device name. Edit the row for the quota-enabled filesystem where the data resides.

Saving the Record

Change the required values, then save the file and exit the editor. The new limits take effect after edquota successfully processes the saved record.

  • In vi or vim, press Esc, type :wq, and press Enter.
  • In nano, press Ctrl+O, press Enter to save, then press Ctrl+X to exit.

Reading Quota Editor Fields

Field — Meaning — Typical administrative action

Filesystem: The device or mounted filesystem to which the row applies — Edit the row containing the data being controlled.

Blocks used: The current amount of allocated disk space — Compare current use with the block limits.

Block soft limit: A storage threshold that may be exceeded temporarily — Set the warning or temporary-overage threshold.

Block hard limit: The absolute storage maximum — Set the point at which additional allocation is rejected.

Inodes used: The number of files and directories owned by the quota subject — Compare object count with inode limits.

Inode soft limit: A temporary-overage threshold for object count — Set the file-count threshold.

Inode hard limit: The absolute maximum number of counted objects — Set the point at which additional files or directories are rejected.

A limit of 0 means that no limit is configured for that resource. Do not assume that all quota tools use the same block size. Displayed block units can vary with the quota implementation and filesystem configuration; confirm the unit reported by the local system before selecting production values.

Soft Limits, Hard Limits, and Grace Periods

A soft limit is a threshold that may be exceeded temporarily while a grace period remains. A hard limit is an absolute maximum that cannot be exceeded.

Limit type — Can it be exceeded? — Grace-period behavior — Result at enforcement

Soft block limit: Yes, temporarily — The user may remain above it during the block grace period — After the period expires, further use is treated as being at an enforced limit until usage is reduced.

Hard block limit: No — A grace period does not permit exceeding it — Writes or other storage allocation can fail.

Soft inode limit: Yes, temporarily — The user may remain above it during the inode grace period — After the period expires, additional object creation is restricted until usage falls below the applicable threshold.

Hard inode limit: No — A grace period does not permit exceeding it — Creating additional files or directories can fail.

For example, a lower soft block limit and higher hard block limit allows a user to exceed the normal allocation temporarily, while still imposing an absolute ceiling. Once the grace period expires, the user must reduce usage before normal allocation can resume.

Set Per-User Block Limits

Suppose bob currently uses a small amount of space on /dev/sdc1. In this illustrative editor record, the current block usage is 4 units:

Filesystem   blocks   soft   hard   inodes   soft   hard
/dev/sdc1       4       6     10       120      0      0

Here, the block soft limit is 6 and the block hard limit is 10. The inode limits remain unlimited because they are still 0. The values are intentionally illustrative; select production values according to the site's policy and the units displayed by the local quota tools.

The lower soft limit gives the user room to exceed the normal threshold temporarily. The higher hard limit prevents allocation beyond the configured maximum. Once the hard block limit is reached, attempted writes, file growth, or other allocation can fail with an out-of-space or quota-exceeded condition.

Set Per-User Inode Limits

Inode limits are edited independently from block limits. For example:

Filesystem   blocks   soft   hard   inodes   soft   hard
/dev/sdc1       4       6     10       120    500    600

This record permits the user to exceed 500 counted objects temporarily, but prevents creation beyond 600. The block limits continue to control storage allocation separately.

Inode limits are especially useful for mail spools, web hosting, build directories, temporary-file areas, and other workloads that produce many small files. A user can have free disk space and still be unable to create a new file after reaching an inode hard limit.

Configure Grace Periods with edquota -t

Use the time-editing form to configure filesystem-level grace periods:

sudo edquota -t

The editor displays grace-period settings for quota-enabled filesystems. A typical record may contain separate values for block and inode quotas:

Filesystem   block grace   inode grace
/dev/sdc1    7 days        3 days

Grace periods determine how long a quota subject may remain above a soft block or inode limit. Where supported, block and inode grace periods can be different.

Grace periods are configured per filesystem, not individually for one user. Changing the grace period for a filesystem changes soft-limit enforcement for all users and groups subject to quotas on that filesystem. Consider the operational effect before changing a value on a multi-user server.

Edit Group Quotas

A group quota limits aggregate usage attributed to a Unix group. It is appropriate for a shared project, department, research team, or other directory whose allocation should be controlled collectively.

sudo edquota -g GROUP_NAME

For example:

sudo edquota -g project

The group record uses the same fundamental concepts as a user record: blocks used, block soft and hard limits, inodes used, inode soft and hard limits, and applicable grace periods. Group quota support must be enabled on the target filesystem. Files must also have the expected group ownership for their usage to be attributed to that group.

Quota type — edquota syntax — Scope — Typical use case

User quota: sudo edquota USER_NAME — One individual account — Restrict each user's personal storage or file count.

Group quota: sudo edquota -g GROUP_NAME — Aggregate usage associated with a Unix group — Control shared project or departmental storage.

Validate Quota Settings and Enforcement

Test changes with a noncritical account and controlled files. Avoid filling a production filesystem or testing with an account that owns important data.

Check Current Usage

Display a user's usage and limits with:

quota bob

Command availability and output differ between distributions and quota packages. Administrators commonly use the following report for all quota-enabled filesystems:

sudo repquota -a

Check the same user or group, and confirm the same filesystem, that was edited in edquota.

Test a Hard Block Limit

As the test account, create or extend controlled files until the hard block limit is approached. For example, an administrator might provide a test directory owned by the account and use a file-generation command appropriate to the displayed block units.

quota bob
# As bob, create or extend test data in the quota-enabled filesystem
quota bob
sudo repquota -a

After the hard limit is reached, an additional allocation should fail. The shell or application may report a quota-exceeded or out-of-space error. The user must delete or move owned files, or an administrator must raise the appropriate quota, before additional allocation can succeed.

Clean Up

Remove the test files after validation, then run quota bob or sudo repquota -a again to confirm that usage has fallen. Do not leave test data consuming quota space.

Troubleshooting

edquota Has No Usable Quota Record

If edquota reports that quotas are unavailable or opens no usable record, likely causes include:

  • The filesystem does not have quota support enabled.
  • Quota accounting has not been initialized or activated.
  • The target user's files are not on a quota-enabled filesystem.

Verify the mount and quota configuration, initialize and activate quota accounting according to the filesystem and distribution procedure, and confirm that the intended filesystem contains the user's data.

The User Writes After Exceeding a Soft Limit

This may be normal if the grace period has not expired and the hard limit has not been reached. Check grace settings with sudo edquota -t, review usage with quota or repquota, and verify that enforcement—not merely accounting—is active.

Files Cannot Be Created Despite Free Disk Space

Check both block and inode values. The user may have reached a block hard quota or an inode hard quota. Free filesystem capacity does not bypass an assigned quota. Delete or move owned files, or adjust the relevant limit according to policy.

Edited Values Do Not Appear in Reports

  • Confirm that the editor session was saved correctly.
  • Reopen the record and verify the edited user, group, and filesystem row.
  • Use quota or repquota against the same filesystem where the test data resides.

A Group Quota Does Not Enforce

Verify that group quota support is enabled, that files have the expected group ownership, and that the users have the expected group membership. Also confirm that the tested files are on the filesystem for which the group quota record was configured.

Exam-Relevant Notes

  • edquota USER_NAME edits an individual user's quota.
  • edquota -g GROUP_NAME edits a group's shared quota.
  • edquota -t edits filesystem-level grace periods.
  • A soft limit may be exceeded temporarily; a hard limit is absolute.
  • Blocks measure allocated storage, while inodes measure filesystem objects such as files and directories.
  • A value of zero means no configured limit for that resource.
  • Quota editing requires administrative privileges and an already quota-enabled filesystem.
  • Free space does not imply that a user can allocate more space when a block or inode quota has been reached.

Related Linux Administration Topics