Atlantic.Net Blog

How to Enable User Quotas in cPanel/WHM

This tutorial will explain how to enable user quotas on Atlantic.Net’s cPanel Cloud Servers. Before we get into the details, let’s do some housekeeping:

Verified on 7/12/20 for cPanel on CentOS 7.2 64-bit

Prerequisites

  • Atlantic.Net Cloud Account

Click here to sign up for your free account!

  • SSH Program

Don’t have one? Follow the guides below for how to SSH:

From Windows
From Linux/Mac

  • Atlantic.Net cPanel Server

Follow this simple guide for how to quickly create a cPanel server:

Create cpanel


Connecting to Your cPanel Server

Now it’s time to connect to your server via SSH:

ssh root@[IP Address]

Check If Your System Has Quotas Enabled

mount

Find the line that says

/dev/sda1

and if there is no quota enabled, it will say

noquota...
/dev/sda1 on / type xfs (rw,relatime,attr2,inode64,noquota)
...

Edit the default Grub file

By editing the default Grub file, we can specify that the file system should have quotas enabled when the system boots up.

Edit the default Grub file with your favorite editor:

nano /etc/default/grub

Modify the following line from:

GRUB_CMDLINE_LINUX=””

to:

GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root crashkernel=auto rhgb quiet rootflags=uquota,pquota"

Note: By default, our cPanel Cloud Servers do not have swap enabled. If you have enabled it, you can prepend rd.lvm.lv=centos/swap before rd.lvm.lv=centos/root.

The resulting file should look like this:

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root crashkernel=auto rhgb quiet rootflags=uquota,pquota"
GRUB_DISABLE_RECOVERY="true"

Generate the New Grub Configuration File

Now that we have edited the default Grub file, we must use it to generate the Grub bootloader configuration file. First, let’s make a backup of our Grub configuration:

cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.bak
grub2-mkconfig -o /boot/grub2/grub.cfg

If done correctly, the system will let you know you generated the file successfully.

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-327.10.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.10.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-17115f95ddd92d410be8cb803e2d845d
Found initrd image: /boot/initramfs-0-rescue-17115f95ddd92d410be8cb803e2d845d.img
done

Finishing Up

In order for the new changes to take effect, let’s reboot the system:

reboot

Allow a minute or two for the cPanel server to reboot. Once it has rebooted, SSH back into the server.

ssh root@[IP Address]

Let’s check mount again to see if quota shows up now:

mount
...
/dev/sda1 on / type xfs (rw,relatime,attr2,inode64,usrquota,prjquota)
...

As we can now see, user quotas and project quotas are now enabled. You have successfully completed enabling quotas on your Atlantic.Net cPanel Cloud Server!

Your next step is to log in to your cPanel’s WHM to setup quotas: https://[your IP address]:2087. There should no longer be any notification about enabling quotas.

Note: If cPanel is telling you quotas are still not enabled for the filesystem, please run the following command in an SSH terminal:

/scripts/fixquotas

Questions? Comments? Concerns? Let us know in the comments below or email us at [email protected]! Interested in a HIPAA-compliant hosting solution in the cloud? Atlantic.Net offers HIPAA compliant cloud hosting services for healthcare organizations.

Get a $250 Credit and Access to Our Free Tier!

Free Tier includes:
G3.2GB Cloud VPS a Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year