Skip to content

Disk Quotas (XFS, old)

Archived — outdated

This documents quota management from when SLURM home directories lived on server02's local XFS RAID array (/raid_storage). Storage has since moved off that array, and quotas are no longer managed this way. Kept here for historical reference, not as current procedure.

Quota management for SLURM users on the XFS RAID storage system.

XFS Quota Setup

One-time setup to enable disk quotas for SLURM users on the XFS RAID storage system.

Note

Some commands may differ if the filesystem is ext4 instead of XFS.

Prerequisites Check

First, verify your RAID storage setup:

# Check filesystem type
sudo blkid /dev/md0

# Check current mount
mount | grep raid_storage

Expected output: /dev/md0 on /raid_storage type xfs (...)

Configure /etc/fstab for XFS Quota Support

Edit /etc/fstab to include XFS quota options:

sudo nano /etc/fstab

Change the entry for /raid_storage to include quota options:

# Before:
/dev/md0 /raid_storage xfs defaults 0 0

# After:
/dev/md0 /raid_storage xfs defaults,usrquota,grpquota 0 0

Remount Filesystem with Quota Options

Since XFS filesystems may be busy, you might need to stop services first:

# Stop NFS if running
sudo systemctl stop nfs-kernel-server

# Unmount and remount
sudo umount /raid_storage
sudo mount /raid_storage

# Restart NFS if needed
sudo systemctl start nfs-kernel-server

Alternative method (if unmount fails):

sudo mount -o remount,usrquota,grpquota /raid_storage

Verify Mount Options

mount | grep raid_storage

This should show: /dev/md0 on /raid_storage type xfs (rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,sunit=1024,swidth=3072,usrquota,grpquota)

Enable XFS Quotas

Unlike ext4, XFS quotas are enabled using xfs_quota commands:

# Enable user quotas
sudo xfs_quota -x -c 'enable -uv' /raid_storage

# Enable group quotas
sudo xfs_quota -x -c 'enable -gv' /raid_storage

Verify Quota Status

sudo xfs_quota -x -c 'state -u' /raid_storage

Expected output:

User quota state on /raid_storage (/dev/md0)
 Accounting: ON
 Enforcement: ON
 Inode: #775842 (4 blocks, 4 extents)

Manual Per-User Quota (Raw xfs_quota)

Note

This is the raw, per-user XFS primitive — useful for understanding or a one-off manual override. Day-to-day quota management is per-group and should go through the squota tool instead, which is what new accounts actually get configured with.

To set a 250GB quota for a specific user:

sudo xfs_quota -x -c 'limit -u bsoft=0 bhard=250G username' /raid_storage

For different sizes:

# 500GB quota
sudo xfs_quota -x -c 'limit -u bsoft=0 bhard=500G username' /raid_storage

# 1TB quota
sudo xfs_quota -x -c 'limit -u bsoft=0 bhard=1T username' /raid_storage

To check quotas for a specific user:

sudo xfs_quota -x -c 'quota -u username' /raid_storage

To check quotas for all users:

sudo xfs_quota -x -c 'report -u' /raid_storage

Human-readable format:

sudo xfs_quota -x -c 'report -u -h' /raid_storage

To remove a user's quota:

sudo xfs_quota -x -c 'limit -u bsoft=0 bhard=0 username' /raid_storage

Automatic Group Quota on New Users

New accounts get a group quota set automatically by set_group_quota() in system_manager.py, which runs the group-level equivalent of the commands above (xfs_quota -x -c 'limit -g ...') as part of both manual and automatic user creation.

squota Tool

squota is the day-to-day quota tool for admins — it shows current disk usage and lets you set XFS quota limits, without needing to remember raw xfs_quota syntax.

It's per-group, not per-user

squota always operates on a group quota. If you pass it a username, it resolves that user to their grp_* group first and acts on the whole group's shared quota — it does not set an individual limit for just that one user. All members of the group (the advisor plus their students) share the same pool.

  • Only sets hard limits.
  • Hard-coded disk: /raid_storage.
  • Path: /usr/local/bin/squota

squota

Usage

squota <username|groupname> [new_quota_gb]
squota --all [new_quota_gb]

Examples

# Show quota for a user's group (resolves slurm_motaz -> their grp_* group)
sudo squota slurm_motaz

# Show quota for a group directly
sudo squota grp_motaz

# Set a group's quota to 500GB
sudo squota grp_motaz 500

# Remove a group's quota limit
sudo squota grp_motaz 0

# Show all group quotas
sudo squota --all

# Set every grp_* group to 1250GB
sudo squota --all 1250