16 quotacheck command examples in Linux

quotacheck command audits and corrects quota information by building a table of current disk usage and comparing it to the recorded usage in both the kernel and the quota files. quotacheck will update quota information when possible and prompt the user if it requires input. Most systems that support quotas run this command at system startup. To prevent damage to filesystems or loss of quota data, turn off quotas with quotaoff and umount the system. quotacheck will attempt to remount any mounted filesystem as read-only before scanning.

quotacheck Command Options

The available option to use with quotacheck command are listed in the table below:

Option Remark
-a, –all Check all non-NFS filestystems in /etc/mtab.
-b, –backup Back up quota files before writing new data to them.
-c, –create-files Skip reading existing quota information; just write new files.
-f, –force Force checking on filesystems with quotas currently enabled.
-Fformat , –format=format Check quota files for the specified format. (See quota for valid formats.)
-g, –group Only check group quotas.
-i, –interactive Prompt user for input upon finding errors.
-m, –no-remount Don’t try to remount mounted filesystems.
-M, –try-remount Force check to run in read-write mode if it cannot successfully remount the filesystem in read-only mode.
-n, –use-first-dquot If multiple entries for a user or group are found in a corrupt quota file, use the first entry found.
-R, –exclude-root Don’t check the root filesystem when using the -a option.
-u, –user Only check user quotas. This is the default.
-v, –verbose Print information on the progress of the command.

Example of quotacheck command

1. To scan the file system for a quota:

# quotacheck /

2. To check for a particular user:

# quotacheck -u mike
# quotacheck --user mike

3. To check for a particular group:

# quotacheck -g SUPPORT
# quotacheck --group SUPPORT

4. To create new quota files:

# quota -c /
# quota --create-files /

5. To create backups of old quota files:

# quotacheck -b /
#  quotacheck --backup /

6. To forcefullt check even if quotas are enabled:

# quotacheck -f /
# quotacheck --force /

7. To run in interactive mode:

# quotacheck -i /
# quotacheck --interactive /

8. To use the first copy of duplicate structure:

# quotacheck -n /
# quotacheck --use-first-dquot /

9. To print the mor messages:

# quotacheck -d /
# quotacheck --debug /

10. To not to remount the file systm read only:

# quotacheck -m /
# quotacheck --no-remount /

11. To try remounting filesystem read-only:

# quotacheck -M /
# quotacheck --try-remount /

12. To exclude root when checking all filesystems:

# quotacheck -R /
# quotacheck --exclude-root /

13. To check quota files of specific format:

# quotacheck -F  /
# quotacheck --format= /

14. To check all filesystems:

# quotacheck -a
# quotacheck --all

15. To get the help for quota:

# quota --help

16. To get the version:

# quota -V
# quotacheck --version