Enabling Quotas in CentOS7

The release of EL7 marks the shift from Ext4 to XFS as the default filesystem for RHEL-based distros like CentOS. While XFS brings many improvements and features to the OS, user and group quotas are no longer enabled by default on the root (‘/’) partition.

While quotas are an optional feature, they are recommended to get the full InterWorx experience. Follow these steps from the command line to enable quotas:

Enabling quotas requires restarting the server, which will cause downtime on production systems. If you plan to use quotas, it is recommended to enable them BEFORE installing InterWorx.

First, check if quotas are enabled:

mount | grep ' / '

You should see ‘noquota’ if quotas are disabled, for example:

# /dev/mapper/centos_el7-root on / type xfs (rw,relatime,attr2,inode64,noquota)

Next, edit /etc/default/grub:

vi /etc/default/grub

Find the line beginning with GRUB_CMDLINE_LINUX and append the following:
rootflags=usrquota,grpquota

The line should end up looking something like this:

GRUB_CMDLINE_LINUX="rd.lvm.lv=centos_el7/root vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos_el7/swap crashkernel=auto  vconsole.keymap=us rhgb quiet rootflags=usrquota,grpquota"

Backup the grub configuration:

cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.orig
For servers using EFI, the grub.cfg file is listed here: /boot/efi/EFI/centos/grub.cfg

Generate the new grub configuration:

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

For EFI, use this command:  grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

Reboot:

reboot

Verify success:

mount | grep ' / '

You should see quotas are now enabled:

/dev/mapper/centos_el7-root on / type xfs (rw,relatime,attr2,inode64,usrquota,grpquota)