Setting Up Project Quotas

Configure project quotas to apply a quota to individual directory hierarchies.

Project quotas can be set on individual directory hierarchies, which are known as managed trees. Each managed tree is uniquely identified by a project ID and an optional project name. Projects are defined in the /etc/projects and /etc/projid configuration files. For more information, see the projects(5) and projid(5) manual pages.

The ability to control the disk usage of a directory hierarchy is useful if you don't otherwise want to set quota limits for a privileged user, for example, /var/log, or if many users or groups have write access to a directory, for example, /var/tmp.

To define a project and set quota limits for it:

  1. Mount the file system with project quotas enabled.
    sudo mount -o pquota device mountpoint

    For example, to enable project quotas for the file system mounted at /mnt, you would use the following command:

    sudo mount -o pquota /dev/sdc1 /mnt
  2. Define a unique project ID for the directory hierarchy in the /etc/projects file.
    sudo echo project_ID:mountpoint/directory |sudo tee -a /etc/projects

    For example, you would set a project ID of 51 for the directory hierarchy /mnt/testdir as follows:

    sudo echo 51:/mnt/testdir |sudo tee -a /etc/projects
  3. Create an entry in the /etc/projid file that maps a project name to the project ID.
    sudo echo project_name:project_ID |sudo tee -a /etc/projid

    For example, you would map the project name testproj to the project with ID 51 as follows:

    sudo echo testproj:51 |sudo tee -a /etc/projid