Lustre Project Quotas

From Lustre Wiki
Jump to navigation Jump to search

Overview

Project quotas (available since Lustre 2.10) allow administrators to set quota limits on arbitrary groups of files identified by a numeric project ID, independent of file ownership. This is useful for limiting storage consumed by a particular project, application, or directory tree.

Requirements

  • All servers (MDS and OSS) must be running Lustre 2.10 or later.
  • ldiskfs backend: The project feature must be enabled:
tune2fs -O project /dev/sdXn

This must be done on every MDT and OST device before mounting. On new filesystems formatted with Lustre 2.10+, this is enabled by default.

  • ZFS backend: Requires ZFS 0.8.0 or later for project quota support.
  • All servers in the filesystem must support project quotas. Mixed-version clusters where some servers are older than 2.10 will not enforce project quotas.

Enabling Project Quota Enforcement

Project quota enforcement is enabled together with user/group quotas:

lctl set_param -P osd-*.fsname*.quota_slave_dt.enabled=ugp
lctl set_param -P osd-*.fsname*.quota_slave_md.enabled=ugp

The p in ugp enables project quota enforcement.

Assigning Project IDs

Use lfs project to assign a project ID to files and directories:

# Assign project ID 1 to a directory tree recursively
# -s sets the project ID, -p specifies the ID, -r is recursive
lfs project -s -p 1 -r /mnt/testfs/dir

# Set the inherit flag so new files inherit the project ID
lfs project -s -p 1 -r /mnt/testfs/dir

The -s flag sets the project ID and enables the inherit attribute on directories, so new files and subdirectories automatically inherit the project ID.

Check assigned project IDs:

# Show project ID for files/directories
lfs project /mnt/testfs/dir
lfs project -r /mnt/testfs/dir

# Check project ID and inherit flag
lfs project -d /mnt/testfs/dir

Setting Project Quota Limits

# Set block and inode limits for project ID 1
lfs setquota -p 1 -b 100G -B 110G -i 1000000 -I 1100000 /mnt/testfs

# Set default project quota
lfs setquota -P -b 50G -B 60G -i 500000 -I 600000 /mnt/testfs

Viewing Project Quotas

# Show quota for project ID 1
lfs quota -p 1 /mnt/testfs

# Show verbose quota with per-OST breakdown
lfs quota -p 1 -v /mnt/testfs

# Show all project quotas
lfs quota -p -a /mnt/testfs

Setting Grace Periods for Projects

lfs setquota -p -t -b 3d -i 1w /mnt/testfs

Clearing a Project ID

To remove a project ID assignment from a directory tree:

lfs project -s -p 0 -r /mnt/testfs/dir

Project ID 0 is the default (no project).

Interoperability Notes

  • All servers in the filesystem must be Lustre 2.10+ for project quotas to function.
  • Clients older than 2.10 can still access the filesystem but cannot set project IDs.
  • On ldiskfs, the project feature flag is a filesystem format change. Once enabled, older e2fsprogs versions that do not understand the flag may report errors.
  • Project IDs are stored in the inode on both ldiskfs and ZFS.

Use Cases

  • Per-project storage limits: Assign each research project a unique ID and set per-project block limits.
  • Directory-tree quotas: Assign a project ID to a top-level directory and enable inheritance — all files beneath it count against the project quota.
  • Application sandboxing: Limit how much space a particular application or workflow can consume.

See Also