
quotacheck: Scan, Check, and Repair Quotas
quotacheck: Scan, Check, and Repair Quotas
quotacheck scans a filesystem for disk usage and helps create, check, and repair quota files. A key precaution: run quota checks with quotas turned off to prevent damage or loss of quota files.
When to use quotacheck
- After enabling quotas on a filesystem
- When quota files seem out of sync with actual usage
- After restoring from backups or making large changes to user/group data
Note:quotacheck can modify quota files; ensure quotas are disabled before running it to minimize risk.
Quick start: safe defaults
- Temporarily disable quota management on the affected filesystem(s).
- Run quotacheck to scan and update quota files.
- Re-enable quotas and run quotaon to activate them.
Example workflow for all mounted non-NFS filesystems:
# Step 1: Ensure quotas are off (example for a system using quotaon/quotaoff)
sudo quotaoff -a
# Step 2: Scan and create/update quota files for all non-NFS filesystems
sudo quotacheck --all
# Step 3: Re-enable quotas
sudo quotaon -a
Common usage patterns
- Check quotas on all mounted non-NFS filesystems:
sudo quotacheck --all
- Force check even if quotas are enabled (risk of damage to quota files):
sudo quotacheck --force {{mountpoint}}
- Check quotas on a given filesystem in debug mode (verbose output helpful for troubleshooting):
sudo quotacheck --debug {{mountpoint}}
- Check quotas on a given filesystem, displaying progress:
sudo quotacheck --verbose {{mountpoint}}
- Check user quotas on a filesystem:
sudo quotacheck --user {{user}} {{mountpoint}}
- Check group quotas on a filesystem:
sudo quotacheck --group {{group}} {{mountpoint}}
Flags explained (quick reference)
- —all: operate on all suitable mounted filesystems.
- —force: force a check even if quotas appear enabled; use with caution.
- —debug: verbose diagnostic output for troubleshooting.
- —verbose: show progress during the run.
- —user: focus on a single user quota.
- —group: focus on a single group quota.
Practical pitfalls and tips
- Always disable quotas before running quotacheck. Running with quotas enabled can corrupt quota files.
- Back up quota files before performing checks on critical systems.
- After quotacheck completes, re-enable quotas and run quotaon to activate the quota checks again.
- If you see strange quota usage in reports after a quotacheck, consider re-running with —debug to diagnose the source of inconsistencies.
Troubleshooting quick tips
- If quotacheck reports file system mismatches, verify that filesystems are mounted correctly and that quota files exist or can be created.
- If you must force a check, ensure you have a confirmed backup plan and understand the risk of quota file damage.
- For persistent quota issues, consult the system logs and the man page for quotacheck for environment-specific caveats.
For more details, refer to the quotacheck manual: man quotacheck.