Skip to content

Disk Quotas — Controlling Storage Usage in Linux

Disk Quotas allow Linux administrators to control and limit the amount of disk space and the number of files (inodes) that users or groups can consume on a filesystem. Quotas help prevent a single user or application from exhausting available storage, ensuring fair resource allocation and maintaining system stability. Disk quotas are widely used on multi-user systems, universities, enterprise servers, shared hosting platforms, and cloud environments.


Learning Path

Linux Mastery → Module 9: Storage Management → Lesson 8

Difficulty: Beginner → Intermediate

Reading Time: 75 Minutes

Course Progress

Course: Linux Mastery

Module: Storage Management

Lesson: 8 of 10


What You'll Learn

After completing this lesson, you'll be able to:

  • Understand disk quotas
  • Configure user and group quotas
  • Learn soft and hard limits
  • Enable quota support
  • Monitor quota usage
  • Manage quota violations
  • Apply quota best practices in production

Prerequisites

Complete:

  • Module 1 – Linux Fundamentals
  • Module 2 – Linux Command Line Essentials
  • Module 3 – Text Processing
  • Module 4 – File Management
  • Module 5 – Users and Groups
  • Module 6 – Process Management
  • Module 7 – Package Management
  • Module 8 – Networking
  • Module 9 Lessons 1–7

Why Learn Disk Quotas?

Imagine:

  • One user fills an entire shared server with log files.
  • A developer accidentally uploads hundreds of gigabytes of data.
  • A web hosting customer consumes all available storage.
  • A backup application generates excessive files.

Without quotas:

One User


Consumes All Disk Space


Other Applications Fail

With quotas:

User Reaches Limit


Write Operation Denied


System Continues Operating

What are Disk Quotas?

Disk quotas allow administrators to limit:

  • Disk space usage
  • Number of files (inodes)

Quotas can be applied to:

  • Individual users
  • Groups

Why Use Quotas?

Quotas help:

  • Prevent storage exhaustion
  • Ensure fair resource allocation
  • Protect shared servers
  • Improve storage management
  • Reduce operational risks

Types of Quotas

Linux supports:

  • User Quotas
  • Group Quotas

Example:

Filesystem


User Quotas


Group Quotas

Soft Limit

A soft limit is a warning threshold.

Example:

Limit

100 GB

Current Usage

102 GB

The user can temporarily exceed the limit during the configured grace period.


Hard Limit

A hard limit is an absolute maximum.

Example:

Hard Limit

110 GB

Once reached:

Write Operation


Denied

Grace Period

The grace period allows users to temporarily exceed the soft limit.

Example:

Soft Limit

100 GB


Grace Period

7 Days


Hard Enforcement

After the grace period expires, the soft limit is enforced as if it were a hard limit until usage is reduced.


Quota Workflow

User Writes File


Quota Check


Below Limit


File Created

OR

Hard Limit Reached


Operation Denied

Enable Quotas

Edit:

/etc/fstab

Example:

UUID=abcd-1234

/home

ext4

defaults,usrquota,grpquota

0

2

Options:

  • usrquota
  • grpquota

Remount the Filesystem

sudo mount -o remount /home

Create Quota Database

sudo quotacheck -cug /home

Options:

Option Meaning
-c Create quota files
-u User quotas
-g Group quotas

Enable Quotas

sudo quotaon /home

Verify:

sudo quotaon -p /home

Configure User Quota

sudo edquota username

Example:

Soft

100000

Hard

120000

Configure Group Quota

sudo edquota -g developers

Copy Quotas

Copy quota settings from one user to another.

sudo edquota -p user1 user2

View User Quota

quota -u username

View Current User Quota

quota

Display Quota Report

sudo repquota /home

Shows:

  • Users
  • Groups
  • Space usage
  • Soft limits
  • Hard limits

Disable Quotas

sudo quotaoff /home

Common Commands

Create quota database.

quotacheck -cug /home

Enable quotas.

quotaon /home

Edit quotas.

edquota username

View quotas.

quota

Quota report.

repquota /home

Real Production Examples

Set quota for a developer.

sudo edquota developer1

View quota usage.

quota -u developer1

Generate report.

sudo repquota /home

Production Perspective

Disk quotas are commonly used for:

  • Multi-user Linux servers
  • University computer labs
  • Shared hosting platforms
  • Development servers
  • Cloud virtual machines
  • Enterprise storage
  • Home directories
  • Shared file servers

Quotas help prevent individual users from consuming excessive storage resources.


Hands-on Lab

Task 1

View mounted filesystems.

df -Th

Task 2

Enable quota support in /etc/fstab.


Task 3

Remount the filesystem.

sudo mount -o remount /home

Task 4

Create quota files.

sudo quotacheck -cug /home

Task 5

Enable quotas.

sudo quotaon /home

Task 6

Configure a user quota.

sudo edquota student1

Task 7

View quota usage.

quota -u student1

Task 8

Generate a quota report.

sudo repquota /home

Command Deep Dive

Command Purpose Production Example
quotacheck Create quota database Initial configuration
quotaon Enable quotas Production servers
quotaoff Disable quotas Maintenance
edquota Configure quotas User management
quota View quota usage User monitoring
repquota Generate quota report Capacity planning

Soft Limit vs Hard Limit

Feature Soft Limit Hard Limit
Warning Threshold Yes No
Temporary Exceeding Allowed Yes No
Grace Period Yes No
Absolute Maximum No Yes

Common Quota Errors

Error Possible Cause
Quota not enabled quotaon not executed
No quota support Missing usrquota/grpquota mount options
Permission denied Insufficient privileges
Quota exceeded Hard limit reached

Production Troubleshooting Scenario

Scenario

A shared development server reports:

No space left on device

Investigation:

df -h

The filesystem is full.

Generate a quota report.

sudo repquota /home

The report shows one developer consuming most of the available storage.

The administrator sets appropriate quotas.

sudo edquota developer1

Future storage growth is controlled, preventing one user from impacting others.


Best Practices

  • Enable quotas on shared filesystems.
  • Configure both soft and hard limits.
  • Monitor quota reports regularly.
  • Use reasonable grace periods.
  • Review quotas periodically as storage needs change.
  • Educate users about storage limits.

Common Mistakes

❌ Forgetting to enable quota support in /etc/fstab.

✅ Remember to to enable quota support in /etc/fstab.


❌ Creating quota files but not enabling quotas.

✅ Avoid this mistake: creating quota files but not enabling quotas.


❌ Setting hard limits too low for business needs.

✅ Avoid this mistake: setting hard limits too low for business needs.


❌ Ignoring quota reports until storage becomes full.

✅ Always review quota reports until storage becomes full.


❌ Applying quotas without communicating policies to users.

✅ Test before applying quotas without communicating policies to users.


Interview Questions

Beginner

  1. What is a disk quota?
  2. What is the difference between user and group quotas?
  3. What is a soft limit?
  4. What is a hard limit?

Intermediate

  1. How do you enable quotas on a filesystem?
  2. What is the purpose of quotacheck?
  3. How do you configure quotas for a user?
  4. What does repquota display?

Architect Level

  1. How would you implement quotas on a shared enterprise file server?
  2. How would you design storage policies for hundreds of developers?
  3. How would you monitor quota usage across multiple Linux servers?

Summary

In this lesson, you learned:

  • Disk quota fundamentals
  • User and group quotas
  • Soft and hard limits
  • Grace periods
  • Enabling quotas
  • Managing quota usage
  • Production storage policies

Disk quotas are an essential storage management feature that helps administrators control disk usage, ensure fair resource allocation, and prevent storage exhaustion on multi-user Linux systems.


Key Takeaways

  • Disk quotas control storage usage for users and groups.
  • Soft limits provide warnings and allow temporary overuse.
  • Hard limits prevent further storage allocation.
  • Enable quota support using usrquota and grpquota.
  • Use edquota to configure limits.
  • Monitor storage consumption regularly using quota and repquota.

What's Next?

Backup Basics — Protecting Data in Linux

You'll explore:

  • Why backups are essential
  • Types of backups (Full, Incremental, and Differential)
  • Backup strategies
  • Local and remote backups
  • Backup tools in Linux
  • Backup verification
  • Recovery fundamentals
  • Backup best practices

By the end of the lesson, you'll understand how to design reliable backup strategies, create backups using common Linux tools, and ensure data can be restored quickly in the event of hardware failures, accidental deletions, or system disasters.