Administration
quotacheck
Scan filesystems for disk usage and create quota files.
Additional Notes
quotacheck scans filesystems to create, check, and repair quota database files (aquota.user and aquota.group). It reads the filesystem's directory structure to determine current disk usage for each user and group, then writes this information to the quota record files.
System administrators use quotacheck when enabling quotas on a filesystem, after filesystem corruption that may have affected quota records, or periodically to synchronize quota records with actual disk usage. It is typically run before enabling quotas with quotaon.
Syntax
quotacheck [options] [filesystem...]
Parameters
filesystem: Mount point (e.g.,/home) or device path (e.g.,/dev/sda2).
Common Options
-a,--all: Check all filesystems with quota support enabled in/etc/fstab.-u,--user: Create or update user quota files (aquota.user).-g,--group: Create or update group quota files (aquota.group).-c,--create-files: Create quota files if they do not exist.-v,--verbose: Show detailed output during scanning.-f,--force: Force checking even if quotas are enabled.-m,--no-remount: Do not remount the filesystem read-only for the scan (use on active filesystems).-n,--bad-ids: Skip checking for non-existent UIDs/GIDs.-R,--exclude-root: Exclude the root filesystem when using-a.-b,--no-backup: Do not back up old quota files.
Examples
quotacheck -avug
Scan all filesystems with quotas enabled, updating user and group quota files.
quotacheck -cuv /home
Create and update quota files for /home with verbose output.
quotacheck -m /var
Check /var without remounting it (safe for active filesystems).
quotacheck -f /home
Force quota file checking even if quota is already active.
quotacheck -avugm
Recommended safe command: check all quota-enabled filesystems without remounting.
Practical Notes
- Run
quotacheckbefore enabling quotas withquotaon. Afterward, verify withrepquota -a. - The
-mflag is important on production systems. Without it,quotacheckattempts to remount the filesystem read-only, which may disrupt active users. - Quota files are typically named
aquota.userandaquota.groupand are stored in the root of the filesystem. - Quotas must be enabled in
/etc/fstabwith theusrquotaand/orgrpquotamount options. - On very large filesystems,
quotacheckcan take significant time. Run during maintenance windows. - If
quotacheckreports inconsistencies, you may need to unmount and runfsckon the filesystem before retrying.