How to Fix Quotas


Last modified: January 20, 2022

Overview

Warning:
  • We enable quotas by default on new installations. Quotas on some Ubuntu® servers may not work unless you take additional actions.

  • If you have enabled Quota System Administration notifications in the Contact Manager interface (WHM >> Home >> Server Contacts >> Contact Manager), the system sends notifications when it is ready to reboot and when the quota scan finishes and quotas are functional.

  • CloudLinux™ 7 updates may break quotas. For this reason, after each CloudLinux 7 update, you must run the /usr/local/cpanel/scripts/fixquotas script and then remount the file system.

  • If you disable and then reenable quotas, servers that use the XFS® filesystem and run the CentOS 7, CloudLinux 7 or 8, AlmaLinux OS 8, or Red Hat® Enterprise Linux® (RHEL) 7 operating systems require additional actions for quotas to function properly:

    • WHM Interface — Use WHM’s Initial Quota Setup interface (WHM >> Home >> Server Configuration >> Initial Quota Setup) to configure quotas.

    • Command Line — Run the /usr/local/cpanel/scripts/fixquotas script and then remount the file system.

    • Manually via the Command Line — For instructions on how to perform the /usr/local/cpanel/scripts/fixquotas script’s actions manually, read the Red Hat XFS and XFS Quota Management documentation.

This document describes how to confirm whether you properly configured the disk space quotas on your system’s devices.

  • You must enable quotas for any device on which cPanel accounts exist.

Fix quotas

To verify whether your devices use quotas, perform the following actions:

Important:

You must log in as the root user via SSH on your system before you perform these actions.

Run the mount command

Run the mount command to obtain basic information about currently-mounted file systems.

When you run this command without any arguments, the system displays information for all of its mounted file systems.

Note:

Entries that contain the usrquota variable are quota-enabled.

The following example confirms that the /dev/mapper/VolGroup00-LogVol00 device uses quotas:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw,usrquota)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/usr/tmpDSK on /tmp type ext3 (rw,noexec,nosuid,loop=/dev/loop0)
/tmp on /var/tmp type none (rw,noexec,nosuid,bind)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
Note:

For more information about the mount command, visit the mount command documentation.

Examine the fstab file contents

The file system table (fstab) file maps devices to their respective mount points within a system.

The contents of the fstab file will resemble the following example:

Remember:
Entries that contain the usrquota variable are quota-enabled.
1
2
3
4
5
6
7
8
/dev/sda5               /backup                 ext3    defaults,noexec 0 0
LABEL=/boot             /boot                   ext3    defaults,usrquota  1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/sda5               /swap                   swap    defaults        0 0
/usr/tmpDSK             /tmp                    ext3    defaults,noauto        0 0

The fstab system configuration file displays configuration options in six columns. These options determine the purpose of each file system and how it should mount.

Column Description Example
Device The physical device that contains the data. /dev/sda5
Mountpoint The filepath to the device’s data storage location. /backup
FStype The type of file system. ext3
Options The mount options for the file system. These options include whether quotas are enabled and whether the system or users can execute programs on the device. defaults,noexec
Dump The dump option. The dump backup utility uses this option. 0
Pass The fsck option. The fsck file checking utility uses this option. 0
Note:

The Dump and Pass values do not impact quotas. For more information about the fstab file, visit the fstab command documentation.

How to enable quotas

After you verify which devices do not use quotas, perform the following steps to enable quotas for the desired devices.

Run the initquotas script

To enable quotas on a device, run the /usr/local/cpanel/scripts/initquotas script. This script adds the usrquota string to the Options column in the /etc/fstab file.

Verify that you enabled quota files

After you run the /usr/local/cpanel/scripts/initquotas script, confirm that the quota files exist in the root directory (/) and that each file is greater than 0 bytes.

Use the ls command with a wildcard character. For example:

1
2
3
root@host [/]# ls -l /*.user
-rwxr--r-- 1 root root 13312 Apr 26 16:39 /aquota.user*
-rwxr--r-- 1 root root    32 Apr 19 16:26 /quota.user*

Note:

The example above uses the ls command to list the contents of the root directory (/). The -l flag causes ls output to display in long listing format. This format displays the following information:

  • The file’s permissions.
  • Which user owns the file.
  • Which group owns the file.
  • The size of the file in bytes.
  • The file’s last modification date.

If these files do not exist, run the /usr/local/cpanel/scripts/initquotas script again to create the files.

If these files do exist but quotas do not function, delete these files and then run the /usr/local/cpanel/scripts/initquotas or /usr/local/cpanel/scripts/fixquotas scripts.

Ensure quotas report on the system

Run the following command to confirm that you successfully enabled quotas on the device:

repquota -a

This command prints all of the file systems that exist in the /etc/mtab file with read and write privileges and quota options enabled.

What if my quotas still do not function?

If you experience further problems, perform one of the following actions:

  • Disable the Cache disk quota information setting in the System section of WHM’s Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings).

  • Set the disablequotacache parameter to 0 in the /var/cpanel/cpanel.config file.

If you still experience problems with quotas, open a support ticket.

A note about Virtuozzo®

If you use Virtuozzo, you must perform the following actions:

  • Enable second-level (per-user) quotas in addition to first-level (per-container) quotas.

  • Enable second-level quotas from the parent node.

For more information, read our Enable Quotas on a Virtuozzo VPS documentation.

How to fix quotas on Ubuntu

Some servers that run the Ubuntu operating system do not have the quota_v2 kernel module that enables quotas. If your server runs the Ubuntu operating system and quotas do not work, it may not have the needed module.

Check if your server has the quota_v2 module

Run this command to check if your server has the quota_v2 module:

quotaon /dev/vda1

Note:

Replace /dev/vda1 with the filesystem on which to enable quotas.

This output shows that the server’s kernel does not have the quota_v2 module:

1
2
quotaon: using //quota.user on /dev/vda1 [/]: No such process
quotaon: Quota format not supported in kernel.

Install the quota_v2 module

To install the missing quota_v2 module, perform the following steps:

  1. Check your server’s kernel metapackage.

    a. Find the server’s current boot image. Your output may resemble the following example:

    1
    2
    
    root@ubuntu:~# grep BOOT /proc/cmdline | cut -f1 -d' ' | cut -f2 -d'='
    /boot/vmlinuz-5.4.0-77-generic

    b. Find the kernel package that corresponds to that boot image. Your output may resemble the following example:

    1
    2
    
    root@ubuntu:~# dpkg -S /boot/vmlinuz-5.4.0-77-generic | cut -f1 -d:
    linux-image-5.4.0-77-generic

    c. Run the following command to trace the package-dependency chain, where $package represents the kernel package:

    apt-cache --installed rdepends $package

    Run this command for each package name in the Reverse Depends value until you find the metapackage. The metapackage is the package with an empty Reverse Depends value.

    Your output may resemble the following example:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    
    root@ubuntu:~# apt-cache --installed rdepends linux-image-5.4.0-77-generic
    linux-image-5.4.0-77-generic
    Reverse Depends:
      linux-image-virtual
    
    root@ubuntu:~# apt-cache --installed rdepends linux-image-virtual
    linux-image-virtual
    Reverse Depends:
      linux-virtual
      linux-virtual
    
    root@ubuntu:~# apt-cache --installed rdepends linux-virtual
    linux-virtual
    Reverse Depends:
  2. Check which quota_v2 package you must install for your server’s kernel metapackage:

    Note:

    The /usr/local/cpanel/scripts/fixquotas script automatically installs the following quota_v2 packages for each kernel metapackage it finds on the server. Contact your hosting provider for assistance if your server’s kernel metapackage is not listed and quotas do not work.

    Kernel metapackages and their corresponding quota_v2 packages
    Kernel metapackage quota_v2 package
    linux-aws linux-modules-extra-aws
    linux-aws-edge linux-modules-extra-aws-edge
    linux-aws-lts-20.04 linux-modules-extra-aws-lts-20.04
    linux-azure linux-modules-extra-azure
    linux-azure-cvm linux-modules-extra-azure-cvm
    linux-azure-edge linux-modules-extra-azure-edge
    linux-azure-fde linux-modules-extra-azure-fde
    linux-azure-lts-20.04 linux-modules-extra-azure-lts-20.04
    linux-gcp linux-modules-extra-gcp
    linux-gcp-edge linux-modules-extra-gcp-edge
    linux-gcp-lts-20.04 linux-modules-extra-gcp-lts-20.04
    linux-gke linux-modules-extra-gke
    linux-gke-5.4 linux-modules-extra-gke-5.4
    linux-gkeop linux-modules-extra-gkeop
    linux-gkeop-5.4 linux-modules-extra-gkeop-5.4
    linux-ibm linux-modules-extra-ibm
    linux-ibm-lts-20.04 linux-modules-extra-ibm-lts-20.04
    linux-virtual linux-image-extra-virtual
    linux-virtual-hwe-20.04 linux-image-extra-virtual-hwe-20.04
    linux-virtual-hwe-20.04-edge linux-image-extra-virtual-hwe-20.04-edge

  3. Install the package that contains the quota_v2 module:

    apt install $package
    Note:

    Replace $package with the name of the package that contains the quota_v2 module.

  4. Reboot the server.

  5. Run the /usr/local/cpanel/scripts/fixquotas script.

Additional Documentation