Enabling Quotas

To use quotas, they must first be enabled. Quota support must also be compiled into the kernel. In the unlikely event that your kernel does not contain quota support, you will need to recompile the kernel. This is not a difficult process, but unfortunately it is not completely straightforward either. To clarify the procedure, this section provides a brief tutorial on how to enable user and group quotas for a filesystem on /dev/sda9 mounted under /home. Note that you may enable user quotas only, group quotas only, or both, as your needs dictate.

  1. Set options in /etc/fstab. On the line containing the /home filesystem, add the usrquota and grpquota options to the existing default option, like this:

    /dev/sda9   /home    ext2    defaults,usrquota,grpquota  1  2

    These options tell quota configuration utilities which partitions should be managed when the utilities reference /etc/fstab.

  2. Create the quota.user and quota.group files at the top of the /home filesystem and set their protection bits for root access only:

    # touch /home/quota.user /home/quota.group
    # chmod 600 /home/quota.user /home/quota.group

    These two files are the databases for user and group quotas. Each filesystem with quotas uses its own quota databases. When quotas are enabled, these files will contain binary data (that is, they’re not text files). Note that if you want end users to be able to examine quotas on groups to which they belong, quota.group will need a protection mode of 644 instead of 600.

  3. Run quotacheck to initialize ...

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.