Enable User and Group Disk Quotas in Linux
Learn how to enable Linux user and group disk quotas by configuring /etc/fstab, remounting a filesystem, running quotacheck, and verifying quota accounting.
A Linux disk quota tracks and optionally limits storage consumption on a filesystem. A user quota applies to an individual user ID, while a group quota applies to a group ID.
Quota enablement has two separate parts:
- Accounting: scanning ownership and usage so Linux can record how much space users and groups consume.
- Enforcement: assigning soft limits, hard limits, and possibly grace periods that restrict future usage.
This lesson covers accounting enablement. It does not assign limits automatically. Quotas are configured per filesystem, not globally for every disk or storage device.
Prerequisites and Filesystem Scope
You need administrative access, such as a root shell or sudo. The target must be a locally mounted, writable filesystem whose filesystem type and quota tools support the quota implementation you intend to use.
Before changing anything, identify the target filesystem's:
- Device or UUID
- Mount point
- Filesystem type
- Current mount options
findmnt /data
mount | grep ' /data '
A typical result identifies a device such as /dev/sdc1, a mount point such as /data, and a type such as ext4. The traditional usrquota, grpquota, and quotacheck workflow is common on ext-family filesystems, but quota behavior and storage formats vary by distribution and filesystem. Validate the procedure for the selected filesystem before applying it to production.
How Quota Enablement Works
The normal sequence is to configure persistent mount options, apply those options to the active mount, build accounting data, and verify the result.
| Step | Goal | Primary File or Command | Expected Result |
|---|---|---|---|
| Add quota mount options | Request user and/or group accounting whenever the filesystem is mounted | /etc/fstab | The target entry contains the required quota options |
| Reload mount configuration | Apply the changed options to the active filesystem | mount -o remount /data, or umount followed by mount | Active mount inspection shows quota-related options |
| Build quota accounting files | Scan ownership and usage | quotacheck | User and/or group accounting data is created or rebuilt |
| Verify quota support | Confirm that tracking is available | findmnt, mount, and quota reports | The filesystem and accounting data are visible to quota tools |
Configure Quota Options in /etc/fstab
/etc/fstab is the persistent filesystem table. Each entry describes a filesystem and includes fields for the device, mount point, filesystem type, mount options, dump behavior, and filesystem-check pass order.
The fourth field contains comma-separated mount options. In this example, both user and group quota accounting are requested for /dev/sdc1 mounted at /data:
/dev/sdc1 /data ext4 defaults,usrquota,grpquota 0 2
usrquota enables traditional user quota accounting. grpquota enables traditional group quota accounting. Use only the option needed when the other type is not required:
# User quotas only
/dev/sdc1 /data ext4 defaults,usrquota 0 2
# User and group quotas
/dev/sdc1 /data ext4 defaults,usrquota,grpquota 0 2
Keep the device identifier, mount point, filesystem type, dump field, fsck pass field, and other required options appropriate for your system. The sample device and filesystem are illustrative; use the actual entry for your target filesystem. Do not edit a similarly named entry by mistake, and do not replace required options merely to add quota support.
After saving the file, inspect the edited line carefully. Options must be comma-separated, fields must remain in the correct order, and whitespace must separate fields. Test the specific filesystem before using a broad mount operation or rebooting.
Apply the Modified Mount Configuration
Editing /etc/fstab changes the persistent configuration, but it does not change options on a filesystem that is already mounted. The filesystem must be remounted or detached and mounted again.
Preferred full unmount and mount cycle
Run these commands from a directory outside /data, such as your home directory or /:
cd /
umount /data
mount /data
The final mount /data uses the matching /etc/fstab entry. Avoid doing this while services are actively using the filesystem unless you have planned downtime.
Attempt a remount when appropriate
Some systems and quota configurations support applying the changed options without a full unmount:
mount -o remount /data
Remount support is filesystem- and implementation-dependent. Always inspect the active options afterward. If the quota options do not appear, use a complete unmount and mount cycle when it is safe to do so.
Verify the active mount
findmnt -no TARGET,OPTIONS /data
mount | grep ' /data '
For a filesystem configured for both types, the output should show the target and quota-related options such as usrquota and grpquota. The exact displayed option names can vary with the filesystem and quota implementation.
Create Quota Accounting Files with quotacheck
quotacheck scans filesystem ownership and usage and creates or rebuilds quota accounting data. Run it only after the desired quota mount options are active.
The -c option requests creation of new quota files during a fresh scan. The selection options are:
| Option | Purpose | Typical Use |
|---|---|---|
-c | Create new quota files during the scan | Initial quota accounting setup |
-u | Process user quotas | quotacheck -cu /data |
-g | Process group quotas | quotacheck -cg /data |
-a | Process all applicable locally mounted quota-enabled filesystems | quotacheck -cuga |
Scan one filesystem
For both user and group accounting on /data, use:
quotacheck -cug /data
For user quotas only:
quotacheck -cu /data
For group quotas only:
quotacheck -cg /data
Scan all eligible local filesystems
If several filesystems have been configured with quota options, the all-filesystems form processes applicable locally mounted quota-enabled filesystems:
quotacheck -cuga
Review the output for each filesystem. The -a option does not make an unconfigured filesystem quota-enabled; it selects filesystems that the quota tooling recognizes as eligible.
Scan safely
Quota checking should run while the filesystem is in a stable state. Active writes can change ownership and usage while the scan is running and may produce inconsistent accounting data. Use a maintenance window, stop or quiet applications that write to the filesystem, and follow the filesystem-specific guidance. If necessary, use a maintenance environment or single-user mode, a minimal system state with fewer active services.
Traditional configurations commonly create files such as aquota.user and aquota.group in the filesystem root:
ls -la /data/aquota.*
Names and locations are not universal. They depend on the Linux distribution, filesystem type, quota version, and quota format. Some implementations store quota data differently, so use the files documented for your platform rather than assuming these filenames must exist.
Verification After Enablement
Use at least three checks:
- Confirm that the active mount has the intended user and/or group quota options.
- Confirm that the expected accounting data exists, if the selected implementation uses on-filesystem database files.
- Run the platform's quota reporting tools, such as quota reporting utilities, to confirm that tracking is available.
findmnt -no TARGET,OPTIONS /data
ls -la /data/aquota.*
A successful scan and visible accounting data mean that usage can be tracked. They do not assign limits. A later quota-management step must set per-user or per-group soft and hard limits.
| State | Mount Options Present | Accounting Files Present | Meaning |
|---|---|---|---|
| Not configured | No | No | The filesystem has no enabled traditional quota accounting |
| Configured in fstab but not remounted | Persistent configuration only | Possibly no | The next mount may request quotas, but the current mount does not yet use the new settings |
| Mounted with quota options but no initial scan | Yes | No or incomplete | Quota support is requested, but accounting data has not been initialized |
| Quota accounting initialized | Yes | Expected data present | Usage can be reported; limits still need to be assigned separately |
Practical Example: User and Group Quotas on /data
Assume /dev/sdc1 is an ext4 filesystem mounted at /data.
- Inspect the current mount:
findmnt /data
- Back up and edit
/etc/fstab. Preserve the system's actual device identifier and existing options, adding the quota options to the mount-options field:
/dev/sdc1 /data ext4 defaults,usrquota,grpquota 0 2
- From outside the mount point, apply the entry:
cd /
umount /data
mount /data
- Build both types of accounting data:
quotacheck -cug /data
- Verify the mount and accounting data:
findmnt -no TARGET,OPTIONS /data
ls -la /data/aquota.*
At this point, user and group usage can be tracked. Assign limits separately with the quota administration tools appropriate to the distribution and filesystem.
Troubleshooting
The filesystem is busy and cannot be unmounted
Common causes include a shell whose working directory is inside /data, an application with open files there, or a service that depends on the filesystem.
- Leave the mount point in every shell, including shells opened by other administrators.
- Identify processes using the filesystem with the system's process and open-file inspection tools.
- Stop or relocate affected services during a maintenance window.
- Use an appropriate maintenance or single-user environment when the filesystem must be taken offline.
Quota options are in fstab but not in the active mount
The filesystem may not have been remounted, the wrong fstab entry may have been changed, or the filesystem may use different quota option conventions.
- Review the exact device, mount point, and options in
/etc/fstab. - Try a supported remount, then inspect it with
findmnt. - If the options are still absent, perform a full unmount and mount cycle when safe.
- Consult filesystem-specific quota documentation if traditional options are rejected.
quotacheck does not create expected files
First confirm that the filesystem is actively mounted with the required quota options. Then check that the command includes the correct selection flags: -u for users, -g for groups, and -c for initial creation. With -a, verify that the filesystem is recognized as an eligible locally mounted quota filesystem.
If traditional aquota.user or aquota.group files do not appear, the implementation may use different names or a different storage location. Read the command output and filesystem-specific documentation.
fstab or mount syntax errors occur
Check that all six fstab fields are present and in the correct order, that mount options are comma-separated, and that the device identifier, filesystem type, and mount point are correct. Restore the backup if necessary. Test the specific entry before rebooting or mounting all fstab entries.
Quota support is enabled but nobody is limited
Enablement and accounting do not impose limits. Assign soft and hard limits in a separate quota-management step for the required users or groups.
Operational Considerations
- Boot-time mounting reads
/etc/fstab, so correctly configured entries make quota mount options persistent across reboots. - Repeat quota checks after filesystem recovery, corruption, or suspected accounting inconsistencies.
- Quota tools, option names, database filenames, and database locations vary by distribution, filesystem, and quota format.
- Do not assume that a quota database file alone proves active enforcement; verify both the mount state and quota reporting.
- Plan maintenance carefully for filesystems that cannot be unmounted while the normal system is running.
Key Exam Notes
/etc/fstabprovides persistent mount configuration; editing it alone does not alter an already mounted filesystem.usrquotaselects user quota accounting, andgrpquotaselects group quota accounting in traditional Linux quota setups.quotacheck -cug /datacreates fresh user and group accounting data for one target filesystem.quotacheck -cugarequests fresh user and group scans for all applicable locally mounted quota-enabled filesystems.- Accounting is distinct from assigning soft or hard limits.
- Quota configuration is per filesystem, not a single global setting for every storage device.