ZFS Dataset Quotas: Prevent Disk Space Exhaustion on Linux

Published: November 27, 2025 | Duration: 6:35

ZFS Dataset Quotas Explained: Learn how to set and manage storage quotas on ZFS datasets to protect your storage pool from unlimited space consumption and ensure critical datasets always have available space.

What you’ll learn in this video:

  • How to set storage quotas on ZFS datasets to limit space consumption
  • Understanding quota enforcement and how it protects your pool
  • Verifying quota settings and current usage with zfs get commands
  • Testing quota limits with incompressible random data
  • Adjusting quotas dynamically without downtime or data migration
  • Removing quotas to return datasets to unlimited storage
  • Best practices for using quotas in multi-user and multi-application environments
  • Protecting critical datasets by preventing runaway storage consumption

ZFS quotas provide a powerful mechanism to prevent runaway storage consumption and protect your pool from being filled by a single dataset. Unlike traditional filesystem quotas, ZFS quotas are enforced at the dataset level and can be adjusted dynamically without any downtime.

📝 Video Transcript

00:00 – Introduction
Welcome to Linuxconfig.org. In this tutorial, we’ll learn how to set and manage storage quotas on ZFS datasets. We’ll demonstrate how quotas protect your system from disk space exhaustion by preventing a single dataset from consuming all available storage. You’ll see quota enforcement in action, learn how to modify quota limits, and understand when to use this essential ZFS feature. Let’s get started.

00:39 – Show Current ZFS Setup
We’ll begin by examining our current ZFS environment. First, let’s check our pool status with the pool list. We have a pool named ZFS pool with 9.5 GB of total capacity and 260K already allocated. The pool shows 1x deduplication and is online and healthy. Next, we’ll view all datasets in our pool using ZFS list. Here we see the root ZFS pool dataset using 260K with about 9.2 GB available. Below it is our ZFS pool slash Linuxconfig dataset, currently using 24K of space, also with 9.2 GB. Both datasets are mounted at their respective mount points. Now let’s check if any quota is currently set on our Linuxconfig dataset with ZFS get quota ZFS pool slash Linuxconfig. The output shows the quota property is set to none, meaning there’s no storage limit enforced. The source column shows default, indicating this is the default ZFS behavior. With no quota in place, this dataset could theoretically consume all available pool space.

02:06 – Set and Test Quota Enforcement
Now we’ll set a quota to protect our system from unlimited space consumption. We’ll use sudo zfs set quota equals 100M ZFS pool slash Linuxconfig to limit this dataset to 100 MB. After entering our password, let’s verify the quota was applied with ZFS get quota ZFS pool slash Linuxconfig. The output confirms the quota is now set to 100M with a source of local, meaning we explicitly configured this setting. Let’s navigate into the dataset with cd slash ZFS pool slash Linuxconfig. We’ll check the current space usage with df dash h dot. The file system shows 100M total size with 128K used and 100M available. Running LS shows the directory is currently empty. Now for the critical test. We’ll use the dd command to write a 200MB file from Urandom, which generates incompressible random data. Notice the command fails with disk quota exceeded. The dd command managed to write 101 records in, but only 100 records out before hitting the limit. Exactly 105MB was copied before the quota stopped the write operation. This is quota enforcement in action. Let’s verify what actually happened with df dash h. The file system now shows 100MB total size with 101MB used and 0 bytes available. The use percentage shows 100%, confirming we’ve hit the quota limit. Finally, running LS dash LLH shows our bigfile dot dat is exactly 100MB. The quota successfully prevented the dataset from exceeding its 100MB limit, protecting the rest of the pool from this write operation.

04:24 – Increase Quota and Retry
Sometimes you need more space than initially allocated. Let’s increase our quota to 500MB. We can verify the change with zfs get quota, which now shows 500M as the new limit. Now let’s retry writing that 200MB file. This time the operation succeeds. We see 200 records in and 200 records out, confirming the full 210MB was written successfully. Running df dash h shows the file system status. We now have 500MB total capacity with 201MB used and 300MB still available. The use percentage is 41%, showing we’re well within our new quota limit. Finally, LS dash LH confirms our bigfile is the full 200MB we intended to write. By increasing the quota, we gave the dataset room to grow, while still maintaining protection against unlimited space consumption. This demonstrates how quotas can be adjusted dynamically based on your storage needs, without requiring any downtime or data migration.

05:42 – Remove Quota
Finally, let’s remove the quota entirely to return the dataset to unlimited storage. We set the quota property to none, which removes all restrictions. Running zfs get quota confirms the quota is now back to none with a source of local, showing we’ve explicitly removed the limit we previously set. The dataset can now use any available space in the pool without restriction. Quotas are a powerful tool for preventing runaway storage consumption and protecting your ZFS pool from being filled by a single dataset. You can use them whenever you need to guarantee that critical datasets always have space available, or to enforce storage limits in multi-user or multi-application environments.

06:31 – Conclusion
Subscribe for more Linux tutorials, and thanks for watching.