Btrfs Subvolume Quotas

Introduction

Btrfs quotas control disk usage for subvolumes through quota groups, usually called qgroups. Unlike traditional Unix quotas, they do not limit an individual user or group and do not provide soft limits, grace periods, or file-count limits.

Each Btrfs subvolume has a level-0 qgroup. The module displays the following usage and limit values for each qgroup :

Referenced
All data reachable from the subvolume, including data shared with other subvolumes or snapshots.
Exclusive
Data used only by the subvolume, which would be freed if it were deleted.
Referenced limit
The maximum referenced space that the qgroup may use.
Exclusive limit
The maximum exclusive space that the qgroup may use.

Accounting Modes

When Btrfs quotas are enabled, the accounting mode configured in the module settings is used :
Full accounting
Tracks shared space between subvolumes and snapshots. This is the recommended mode when accurate referenced and exclusive usage is required.
Simple accounting
Tracks original ownership with lower overhead, but does not fully track space shared between subvolumes and snapshots.
In simple accounting mode, both values show space assigned to the subvolume that first wrote the data.

Changing the module setting does not convert an already-enabled filesystem. The selected mode is used the next time quotas are enabled.

Managing Btrfs Quotas

The main module page shows each mounted Btrfs filesystem, its accounting mode, consistency state, and an action to enable or disable quotas. Click a filesystem path to view its qgroups, usage, and limits. Click a qgroup ID to edit its referenced and exclusive limits. The top-level qgroup 0/5 is shown for information only because limiting it could stop filesystem changes.

Because quota state and qgroup IDs apply to the whole underlying Btrfs filesystem, delegated Webmin users must be allowed to manage all filesystems to access these controls. A permission scoped to one mounted subvolume is not sufficient.

Full accounting also provides a rescan action for rebuilding qgroup accounting in the background. Disabling Btrfs quotas removes all qgroup configuration and limits on the filesystem, so the module always requests confirmation first.