On shared Ubuntu multi-user workstations, academic lab servers, and network-attached storage appliances, unmanaged file creation can quickly lead to disk exhaustion. If a single user downloads massive dataset archives or generates unbounded build artifacts, physical filesystem capacity is consumed entirely, preventing other users from saving work and causing system daemons to fail. On traditional Linux ext4 filesystems, the kernel includes a mature, native quota subsystem that tracks storage block allocation and inode (file count) usage per user and group. Using the quota package alongside edquota and repquota, Ubuntu administrators can enforce hard storage limits, provide grace periods for soft thresholds, and automate disk usage monitoring across user communities.
Architecture of the Linux ext4 Quota Subsystem
The ext4 quota infrastructure operates through kernel-level accounting structures maintained directly on the filesystem:
- Block Limits (Capacity): Regulates the total volume of disk storage (measured in 1 KB blocks) an individual user account or POSIX group can occupy.
- Inode Limits (File Count): Restricts the total number of individual files, directories, and symlinks an entity can create, preventing filesystem inode exhaustion caused by millions of zero-byte temporary files.
- Soft Limit: A warning threshold. Users exceeding a soft limit receive system warning notices and enter a timed grace period (default 7 days) during which they can continue writing files whilst clearing excess data.
- Hard Limit: An absolute, non-negotiable ceiling. Any write operation that would cause a user to exceed their hard limit is immediately terminated with a
Disk quota exceeded(EDQUOT) error.
Installing the Quota Tools on Ubuntu
On Ubuntu systems, the command-line management binaries are bundled inside the quota package.
# Update repositories and install quota utilities
sudo apt update
sudo apt install -y quota quotatool
# Verify installed binaries
quota --version
Enabling Quotas in /etc/fstab Mount Options
To enable quota tracking on an ext4 filesystem (such as /home or a dedicated data volume mounted on /data), configure the mount options inside /etc/fstab.
Open /etc/fstab with root privileges and append the usrquota and grpquota options to the target mount line:
# Example /etc/fstab entry for /home partition
UUID=e2a1b3c4-5d6e-4f7a-8b9c-0d1e2f3a4b5c /home ext4 defaults,usrquota,grpquota 0 2
Remount the filesystem to activate the new kernel mount flags without rebooting:
sudo mount -o remount /home
Verify that the quota flags are actively recognised by the kernel:
mount | grep quota
Initialising Quota Databases via quotacheck
Modern ext4 filesystems maintain binary index databases (aquota.user and aquota.group) at the root of the partition. Initialise and audit these databases using quotacheck:
# Generate user and group quota index databases
sudo quotacheck -cumvg /home
Parameter breakdown:
-c: Creates new quota files (aquota.user,aquota.group).-u&-g: Scans both user and group allocations.-m: Forces scanning on a mounted filesystem.-v: Verbose diagnostic output.
Enable quota enforcement on the mounted partition:
sudo quotaon -v /home
Configuring User Limits via edquota
To set storage limits for a specific user account (e.g. developer1), execute edquota:
sudo edquota -u developer1
The command opens the user’s quota profile in the default system text editor (such as nano):
Disk quotas for user developer1 (uid 1001):
Filesystem blocks soft hard inodes soft hard
/dev/sdb1 240500 5000000 6000000 4200 50000 60000
Edit the columns:
blocks: Current space consumed (1 KB blocks; do not modify manually).soft (blocks): Enter the soft capacity limit (e.g.5000000= ~5 GB).hard (blocks): Enter the hard capacity limit (e.g.6000000= ~6 GB).inodes soft / hard: Enter maximum allowed file count limits.
Save and exit the editor. The kernel applies the updated quotas instantaneously.
Cloning Quota Configurations to Multiple Users
To apply identical quota allocations across an entire development team or classroom cohort without editing accounts individually, use the prototype replication switch:
# Clone developer1's quota limits to developer2 and developer3
sudo edquota -p developer1 developer2 developer3
Configuring Grace Periods and Generating Reports
To modify the grace period granted when users cross their soft limit:
# Edit grace period (e.g. change 7 days to 3 days)
sudo edquota -t
To generate a comprehensive system-wide storage audit report across all users:
sudo repquota -s /home
The repquota command formats outputs with human-readable sizes (GB/MB), displaying active warnings (-- for normal, +- for exceeded soft limit, ++ for blocked hard limit).
Configuring ext4 disk quotas equips Ubuntu administrators with native, kernel-level storage boundaries to prevent unexpected disk exhaustion across multi-tenant environments.