Limit Volume Replica Actual Space Usage
Shuo Wu | October 27, 2025
As some users know, a volume replica’s actual space usage can be greater than volume.spec.size.
This unrestricted space consumption may be unexpected and can lead to disk pressure, node crashes, or even data loss.
This blog introduces several approaches to help limit space usage.
Note: This blog provides a secondary solution. The primary solution is tracked here.
Longhorn version: 1.6.0 or later.
The volume settings Snapshot Max Count and Snapshot Max Size mentioned in this article were introduced in version 1.6.0.
The main reason is the snapshot mechanism. Snapshots allow Longhorn to retain historical data in addition to the current data, which increases storage usage.
For example, consider a volume with a spec size of 5 GB. The user writes 5 GB of data1, creates a snapshot, then overwrites it with another 5 GB of data2. The replica will look like this:
+--------------+ +--------------+
| snapshot +------------>| volume head |
| data1(5G) | | data2(5G) |
+--------------+ +--------------+
In this case, Longhorn uses an additional 5 GB to store the snapshot data (data1), for a total of 10 GB.
Even though the original 5 GB appears overwritten, Longhorn retains it because snapshots are immutable, and users may need to revert to them if the current data becomes corrupted.
For more details about Longhorn’s snapshot mechanism, see the Longhorn documentation - Volumes.
A volume replica consists of snapshots and one volume head. The maximum size of each snapshot or the volume head equals the volume spec size.
Therefore, after setting Snapshot Max Count or Snapshot Max Size, the maximum possible space usage of a volume replica becomes predictable — in other words, we are limiting the replica’s maximum space consumption.
Snapshot Max Count can be set globally for all volumes in Settings, or individually per volume in volume spec.
It limits maximum snapshot count for a volume. The value should be between 2 and 250.
Snapshot Max Size can only be set individually per volume in volume spec.
This setting limits maximum aggregate size of snapshots for a specific volume. You can specify “0” or any value larger than Volume.Spec.Size multiplied by 2. You must double the value of Volume.Spec.Size because Longhorn requires at least two snapshots to function properly.
For more details about these 2 settings, see the Longhorn documentation - Volumes Specific Settings.
When using snapshot max size, ideally:
<snapshot max size> + <volume spec size> * 1.
<volume spec size> * 1 accounts for the volume head.<snapshot max size> + <volume spec size> * 2.
<volume spec size> * 2 accounts for the volume head, plus the temporary space used during deletion/purge.When using snapshot max count, ideally:
(<snapshot max count> + 1) * <volume spec size>.
The extra 1 accounts for the volume head.When deleting a snapshot, Longhorn merges the data from the deleting snapshot into its child snapshot (the next one in the chain). During this process, Longhorn temporarily copies the child snapshot’s data to the deleting snapshot, which causes temporary extra space usage.
Let’s consider an example as the ideal case: Assume a volume with a 5 GB spec size. We want to strictly ensure (including during deletion/purge) that each replica does not use more than 23 GB.
snapshot max count for volume3.snap1, snap2, and snap3 are each 5 GB.Therefore, the maximum usage remains 20 GB.

snapshot max size for volume13GB.snap1 = 0 GB, snap2 = 5 GB, snap3 = 5 GB, snap4 = 3 GB.
snap1 and triggering a purge, an extra 5 GB is temporarily used to merge snap1 and snap2, since Longhorn copies snap2’s data into the deleting snap1. This is why snap1 shows ~5 GB instead of 0 GB in the screenshot.13 GB + 5 GB + 5 GB = 23 GB.
13 GB, creating another snapshot will be rejected.
These two settings cannot provide a fine-grained limit on space usage. Let’s see why.
In the ideal case above:
snapshot max count = 3, the volume uses up to 20 GB — below the intended limit.snapshot max size = 13 GB, the volume reaches 23 GB only if the total snapshot size exactly equals 13 GB — which rarely happens in real-world scenarios.In practice, snapshot sizes are unpredictable and rarely match the spec size. For example, if each snapshot actually uses 4 GB:
snapshot max count = 3: When deleting a random snapshot and triggering purge, the volume’s maximum usage is 4 GB × 2 (remaining snapshots) + 5 GB (temporary purge space) + 5 GB (volume head) = 16 GB.snapshot max size = 13 GB: Suppose we create 5 snapshots — four at 3 GB each, and one empty (snap2). The total snapshot size is 12 GB. When deleting snap2 and triggering purge, the volume’s maximum usage is 3 GB × 4 (snapshots) + 3 GB (temporary purge) + 5 GB (volume head) = 20 GB.Therefore, the actual maximum space usage may be lower than the theoretical maximum, resulting in unused reserved space. These settings provide only a rough limit.
Additionally, when snapshot count or size reaches its limit, new snapshot creation will fail. In that case, you may need to:
To further improve disk space efficiency, we recommend:
snapshot-cleanup or snapshot-delete jobs.filesystem-trim jobs, and enable Allow Snapshots Removal During Trim if snapshots are less critical.Note: Issue #11670 affects filesystem trim behavior.
longhorn_volume_actual_size_bytes.
This can serve as an early warning and allow manual intervention before disks become full.Recent posts
Strengthen Longhorn with Automated End-to-End Tests© 2019-2026 Longhorn Authors | Documentation Distributed under CC-BY-4.0
© 2026 The Linux Foundation. All rights reserved. The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.