How to: Enable Quotas ===================== .. warning:: It is recommended to enable quotas **before** installing InterWorx. While quotas are an optional feature, they are recommended for the full InterWorx experience. This article includes instructions on how to enable quotas for XFS (the default file system for CentOS 7) and EXT4. .. note:: Quotas should be enabled on the partition where the /home directory is located. If /home is located under root (‘/’) , then quotas should be enabled on root (‘/’) . If there is a separate /home partition, then quotas should be enabled on /home, instead. .. contents:: To Identify the File System type -------------------------------- #. Log in to the server at the CLI as root, either via SSH or from the terminal #. At the CLI, check if quotas are already enabled by running the following: .. code-block:: mount | grep ' / ' - The filesystem type will show in the output (emphasis added): .. code-block:: [root@server ~]# mount | grep ' / ' /dev/nvme0n1p1 on / type **xfs** (rw,relatime,attr2,inode64,noquota) [root@server ~]# or .. code-block:: [root@server ~]# mount | grep ' / ' /dev/xvda1 on / type **ext4** (rw) [root@server ~]# To Enable Quotas for XFS ------------------------ The following details enabling quotas for root ('/'). If there is a separate /home partition, replace all instances of / in the following examples with /home, instead. #. Log in to the server at the CLI as root, either via SSH or from the terminal #. At the CLI, check if quotas are already enabled by running the following: .. code-block:: mount | grep ' / ' - If quotas are disabled, the output will state 'noquota' .. code-block:: [root@server ~]# mount | grep ' / ' /dev/mapper/centos_el7-root on / type xfs (rw,relatime,attr2,inode64,noquota) [root@server ~]# - If quotas are already enabled, the output will show 'usrquota' and 'groupquota' .. code-block:: [root@server ~]# mount | grep ' / ' /dev/mapper/centos_el7-root on / type xfs (rw,relatime,attr2,inode64,usrquota,grpquota) [root@server ~]# #. In a text editor, open ``/etc/default/grub`` #. Append ``rootflags=usrquota,grpquota`` to the line beginning with GRUB_CMDLINE_LINUX .. code-block:: 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: .. code-block:: cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.orig - For servers using EFI, the grub.cfg file is located at ``/boot/efi/EFI/centos/grub.cfg`` .. code-block:: cp /boot/efi/EFI/centos/grub.cfg /boot/efi/EFI/centos/grub.cfg.orig #. Generate the new grub configuration .. code-block:: grub2-mkconfig -o /boot/grub2/grub.cfg - For servers using EFI: .. code-block:: grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg #. Reboot the server #. Verify that quotas have been enabled .. code-block:: mount | grep ' / ' To Enable Quotas for EXT4 ------------------------- The following details enabling quotas for root ('/'). If there is a separate /home partition, replace all instances of / in the following examples with /home, instead. #. At the CLI, check if quotas are already enabled by running the following: .. code-block:: mount | grep ' / ' - If quotas are disabled, the output will state 'noquota' .. code-block:: [root@server ~]# mount | grep ' / ' /dev/xvda1 on / type ext4 (rw) [root@server ~]# - If quotas are already enabled, the output will show 'usrquota' and 'groupquota' .. code-block:: [root@server ~]# mount | grep ' / ' /dev/xvda1 on / type ext4 (rw,usrquota,grpquota) [root@server ~]# #. Using a text editor, open the file ``/etc/fstab``. The following example uses the Vim text editor: .. code-block:: vim /etc/fstab #. Edit the entry for /, adding "usrquota" and "grpquota" options after "defaults". The completed line will look similar to the following: .. code-block:: UUID=92c597ca-70f5-48ee-a173-64188df8ca55 / ext4 defaults,usrquota,grpquota 1 1 #. Save and exit the text editor #. Remount the / filesystem with the following: .. code-block:: mount -o remount / #. Repeat Step 1 to check if quotas are enabled: .. code-block:: [root@server ~]# mount | grep ' / ' /dev/xvda1 on / type ext4 (rw,usrquota,grpquota) [root@server ~]# #. Create the quota database using the following ``quotacheck`` command. This creates ``aquota.user`` and ``aquota.group`` under /: .. code-block:: quotacheck -cugvm / The flags: - -c create quota file - -v verbose output - -u user disk quota - -g group disk quota - -m force checking The output will look similar to the following: .. code-block:: [root@server ~]# quotacheck -cugvm / 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. quotacheck: Scanning /dev/xvda1 [/] done quotacheck: Cannot stat old user quota file //aquota.user: No such file or directory. Usage will not be substracted. quotacheck: Cannot stat old group quota file //aquota.group: No such file or directory. Usage will not be substracted. quotacheck: Cannot stat old user quota file //aquota.user: No such file or directory. Usage will not be substracted. quotacheck: Cannot stat old group quota file //aquota.group: No such file or directory. Usage will not be substracted. quotacheck: Checked 15509 directories and 97004 files quotacheck: Old file not found. quotacheck: Old file not found. [root@server ~]# #. Run the ``quotaon`` command to turn on quotas: .. code-block:: quotaon /