quotacheck – Check disk usage and limits

The quotacheck command is used to scan a file system and create or update the disk usage database for file systems that are using disk quotas. This command is used to ensure that the disk usage and limits are being properly tracked and reported.

Overview

The quotacheck command is typically used in conjunction with the quota command to implement and manage disk quotas on a Linux system. The quotacheck command is used to create or update the disk usage database that is used by the quota command to track disk usage and enforce disk quotas.

The basic syntax for the quotacheck command is as follows:

quotacheck [options] [filesystem]

Where [options] are any command line options that you want to use with the command, and [filesystem] is the path to the file system that you want to scan.

Here are some examples of how to use the quotacheck command:

# Scan the /home file system for disk usage and limits
quotacheck /home

# Scan the /home file system and force a complete rebuild of the disk usage database
quotacheck -vug /home

The quotacheck command is typically run as a background process, as it can take a long time to scan a large file system. Once the command has completed, the disk usage database will be updated with the latest disk usage and limits for the file system.

Options

Here are the available options for the quotacheck command:

Option Description
-a Scan all file systems that are listed in /etc/fstab.
-c Only check the consistency of the disk usage database, do not update it.
-f Force a scan of the file system, even if it is marked as clean.
-m Only scan mounted file systems.
-u Update the disk usage database with the latest disk usage and limits.
-v Verbose mode, print detailed output during the scan.
-x Exclude file systems that are listed in /etc/fstab.

Troubleshooting Tips

Here are some common issues that you may encounter when using the quotacheck command, along with solutions:

  • quotacheck: Cannot find filesystem to check or filesystem not mounted with quota option. This error message indicates that the file system that you are trying to scan either does not exist or is not mounted with the quota option. Make sure that the file system exists and is mounted with the quota option.
  • quotacheck: Scanning /dev/sda1 [/]: not mounted with quota option. This error message indicates that the file system that you are trying to scan is not mounted with the quota option. To fix this issue, remount the file system with the quota option.
  • quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown. This warning message indicates that your system supports journaled quotas, but you are not using them. Journaled quotas can help to prevent the need to run quotacheck after an unclean shutdown. To switch to journaled quotas, you will need to modify your /etc/fstab file and reboot your system.

Notes

  • The quotacheck command should be run periodically to ensure that the disk usage database is up-to-date and accurate.
  • The quotacheck command can take a long time to run on large file systems, so it is recommended to run it as a background process.
  • The quotacheck command should be run after an unclean shutdown to ensure that the disk usage database is consistent and accurate.