Disk quotas prevent individual users or groups from consuming excessive storage on shared Linux systems. Without quotas, a single user can fill an entire filesystem, causing service outages for everyone. This guide covers practical quota setup, monitoring, and enforcement on Linux servers.
How Linux Disk Quotas Work
Linux supports two types of quotas:
- User quotas β Limit storage per user account
- Group quotas β Limit storage per group
Each quota has two limits:
- Soft limit β Warning threshold; user can temporarily exceed it during the grace period
- Hard limit β Absolute maximum; cannot be exceeded under any circumstances
Setting Up Disk Quotas
# Install quota tools
apt install quota # Debian/Ubuntu
yum install quota # RHEL/CentOS
# Enable quotas in /etc/fstab
# Add usrquota,grpquota to mount options:
# /dev/sda1 / ext4 defaults,usrquota,grpquota 0 1
# Remount and initialize
mount -o remount /
quotacheck -cugm /
quotaon -a
Setting User Quotas
# Interactive editor
edquota -u username
# Command-line (soft=500MB, hard=600MB, no file limits)
setquota -u username 500M 600M 0 0 /
# Set grace period
edquota -t
Monitoring Quotas
pip install dargslan-disk-quota
dargslan-quota report # Full quota and filesystem report
dargslan-quota users # User quota listing
dargslan-quota disk # Filesystem capacity
Best Practices
- Set quotas on shared filesystems (/home, /var, project directories)
- Use soft limits with grace periods for warnings before hard enforcement
- Monitor quota usage in your daily admin routine
- Alert users approaching their limits before they hit hard caps
- Regularly review and adjust quotas as storage needs change
Download our free Disk Quota Management Cheat Sheet for essential commands. For deeper Linux storage knowledge, check our Linux & DevOps eBooks.