Search

How to create Linux disk quota database files (aquota.group and aquota.user) using quotacheck command

The first time the system is booted with Linux disk quotas enabled in /etc/fstab, quotas are not turned on because the quota database files for the filesystem do not exist. The Linux quotacheck command is used to create these files. The following command can be used to create quota files (should be executed as root user).

root@RHEL2 ~]# quotacheck -cug /dev/sdb1

After the command is executed successfully, you can see the quota database files (aquota.group and aquota.user) in the root of the mount point of the device.

Once the quota database is created, it can be populated with the current disk useage by executing below command.

quotacheck -uvg <devicename>

Example:

root@RHEL2 ~]# quotacheck -uvg /dev/sdb1

Note: -a option is used to check all mounted filesystems

Because disk usage can change when the filesystem is mounted in read-write mode, it is recommended that quotacheck be run when the filesystem is mounted read-only. If the filesystem is mounted when quotacheck is run, quotacheck will try to mount it read-only before starting the scan. It then remounts it in read-write mode after the scan is complete.

If quotacheck can’t remount the filesystem read-only before starting, you can force the quota check anyway by using the -m command-line option.

root@RHEL2 ~]# quotacheck -muvg /dev/sdb1

Note: The quotacheck utility should be run on a regular basis to keep quotas accurate or after a system crash in which the filesystem was not unmounted cleanly.

Related Tutorials
• Introduction to Linux Disk Quota
• How to turn on and turn off Linux disk quota using quotaon and quotaoff commands
• How to manage Linux disk quota using edquota and repquota commands