You ran zfs destroy on a large snapshot or a dataset full of snapshots. The command returned in seconds, but zpool list shows the space did not come back, write latency is climbing, and applications are starting to complain. Or the destroy itself hung, and now every zfs and zpool command against that pool is stuck in D state.
Both symptoms have the same root: snapshot destruction in ZFS is not a single operation. The command deletes the snapshot’s metadata quickly, but the actual block freeing runs asynchronously in the background, competing with production I/O for disk bandwidth, CPU, and dirty-data budget. On a busy or near-full pool, that background work can take hours and slows everything else while it runs.
The backlog is visible, measurable, and tunable. The pool property freeing tells you exactly how much space is still waiting to be reclaimed, and a small set of module parameters controls how aggressively ZFS spends I/O reclaiming it.
What this means
ZFS is copy-on-write. Destroying a snapshot means walking its block tree and marking every block that is no longer referenced as free. On a snapshot that references hundreds of gigabytes or terabytes, that is a lot of block pointer work, and each free is itself a metadata write that must go through the normal transaction group (TXG) pipeline.
With the feature@async_destroy pool feature (enabled by default on pools created with OpenZFS), zfs destroy does not wait for this work. It records the blocks to be freed in an on-disk list (the free bpobj) and returns. A background thread then works through that list, spending a bounded amount of time freeing blocks in each TXG commit.
Consequences an operator needs to internalize:
- Space returns gradually, not instantly.
zpool get freeing <pool>shows the outstanding backlog. Over timefreeingdecreases whilefreeincreases. If you destroyed 2 TB andfreeingsays 1.4 TB, reclaim is roughly a third done. - The backlog survives export/import. The free list is on-disk state. Rebooting or re-importing the pool does not cancel it; freeing resumes where it left off.
- Freeing is not free. Every freed block dirties metadata. On a near-full pool, those metadata writes consume the same dirty-data budget and disk bandwidth your foreground writes need. This is how a “cleanup” operation makes the capacity death spiral worse before it makes it better.
flowchart TD A[zfs destroy on large snapshot] --> B[metadata deleted, command returns] B --> C[blocks queued in on-disk free list] C --> D[async destroy thread frees blocks per TXG] D --> E[metadata writes consume dirty-data budget] D --> F[extra I/O competes with foreground] E --> G[write latency rises, TXG sync extends] F --> G G --> H[apps slow while freeing drains] D --> I[freeing property counts down to 0]
Common causes
| Cause | What it looks like | First thing to check |
|---|---|---|
| Normal async destroy on a big snapshot | zfs destroy returned fast; space trickling back; freeing large and slowly decreasing | zpool get freeing <pool>; watch it trend down over minutes |
| Near-full pool contention | Freeing running, but write latency and TXG sync time spiking; pool CAP above 85% | zpool list -o name,cap,freeing; /proc/spl/kstat/zfs/<pool>/txgs stime |
| Oversized batch destroy | Dozens of recursive destroys launched at once; all zfs/zpool commands hang in D state | ps aux for D-state processes; cat /sys/module/zfs/parameters/zfs_free_min_time_ms |
| Many-snapshot dataset destroy | zfs destroy -r on a dataset with hundreds to thousands of snapshots stalls writes for minutes; CPU-bound, not disk-bound | Snapshot count: zfs list -t snapshot -r <dataset> | wc -l; watch z_ kernel threads in top -H |
| Throttle misconfiguration for the version | Reclaim crawling on a pool under load; dirty-data budget starved by frees | cat /sys/module/zfs/parameters/zfs_per_txg_dirty_frees_percent |
| Dedup pool | Destroy takes far longer than data size suggests; DDT updates on every freed block | zpool get dedupratio <pool>; per-dataset zfs get dedup |
Quick checks
All read-only and safe to run during an incident.
# How much space is still waiting to be reclaimed?
zpool get freeing <pool>
# One line: capacity and freeing together
zpool list -H -o name,size,alloc,free,cap,freeing
# Is a scrub or resilver also competing for I/O right now?
zpool status <pool> | grep -A3 "scan:"
# Recent TXG sync times (stime column is sync duration in ns;
# the ndirty column is current dirty bytes)
cat /proc/spl/kstat/zfs/<pool>/txgs | tail -20
# Current async destroy tunables
cat /sys/module/zfs/parameters/zfs_free_min_time_ms
cat /sys/module/zfs/parameters/zfs_per_txg_dirty_frees_percent
# Per-vdev latency and queue depth while freeing runs
zpool iostat -l -q -v <pool> 5
# Dirty data limit; compare against ndirty from the txgs kstat above
cat /sys/module/zfs/parameters/zfs_dirty_data_max
What to look for:
freeingdecreasing steadily: reclaim is healthy. The destroy is not stuck; it is just not done.freeingstatic for many minutes on a pool with active writes: freeing is being starved or throttled, or you are hitting a stall condition.- TXG
stimeconsistently above the 5-secondzfs_txg_timeoutdefault while freeing runs: the write pipeline is saturated and foreground writes are queuing behind reclaim I/O.
How to diagnose it
- Confirm the backlog exists.
zpool get freeing <pool>. Iffreeingis 0, your slowness is not async destroy; look elsewhere (TXG sync pressure, a slow vdev, scrub contention). - Measure the drain rate. Sample
freeingtwice, a few minutes apart. Divide the delta by the interval to get reclaim throughput in bytes/sec. Divide the remaining backlog by that rate for a rough ETA. Some guides referencezpool wait -t free <pool>to block untilfreeingreaches zero; confirm withzpool wait -hon your version before scripting against it. - Check pool capacity.
zpool list -o name,cap,freeing. Above 85% CAP, async destroy competes with a metaslab allocator that is already working hard. Above ~96%, you are in the emergency zone where reclaim and foreground writes fight over slop-adjacent free space. - Check what else is running. Scrubs, resilvers, and
zfs sendall consume the same I/O budget.zpool statusshows scan activity. A destroy during a scrub window will look far worse than the same destroy on an idle pool. - Look at the write pipeline, not just the disks. TXG
stimein/proc/spl/kstat/zfs/<pool>/txgsand dirty data (ndirty) versuszfs_dirty_data_maxtell you whether foreground writes are being throttled. Ifzpool iostat -qshows growing pending queues on data vdevs whilefreeingdrains, the disks are the contention point. If queues are flat but latency is up, the contention is inside ZFS (CPU, locks, dirty-data budget). - If everything is hung, not just slow: all
zfs/zpoolcommands on the pool stuck in D state after launching many concurrent destroys matches a reported async destroy stall whose documented unblock is settingzfs_free_min_time_msto 0. See Fixes below. - Check for dedup. On a
dedup=onpool, every freed block may require a DDT update. Destroys are slower and thezfs_max_async_dedup_freestunable caps the rate. There is no fast path here; plan for it.
Metrics and signals to monitor
| Signal | Why it matters | Warning sign |
|---|---|---|
freeing pool property | The async destroy backlog itself; your primary truth for “is reclaim progressing” | Large value static or draining far slower than foreground writes need the space |
Pool CAP (zpool list) | Determines how expensive every allocation and free is | Above 85% during a large destroy; above 96% at any time with active writes |
TXG stime | Shows whether the write pipeline is keeping up | Sustained above 2x zfs_txg_timeout (10s+ with the 5s default) while freeing runs |
Dirty data vs zfs_dirty_data_max | Frees consume the same budget as writes | Sustained above 80% of max during reclaim |
Vdev queue depth (zpool iostat -q) | Distinguishes disk saturation from internal ZFS contention | Pending » active on data vdevs during the drain |
Write latency (zpool iostat -l, -w for latency histograms) | The user-visible impact of the contention | Sustained 2x+ baseline during the destroy window |
Snapshot space (usedbysnapshots) | Tells you how big the next destroy will be before you run it | Snapshots holding a large fraction of pool allocation on a pool nearing capacity |
Fixes
Let it drain, on a schedule you choose
If the pool has headroom (CAP under ~80%) and applications are not measurably impacted, the correct fix is usually patience. Async destroy is throttled by design so that it does not monopolize the pool. Watch freeing trend to zero and confirm latency returns to baseline. Do not reboot or export to “clear” it: the backlog is on-disk and resumes after import, and you will have added an import to your problem.
Slow the reclaim down to protect foreground I/O
zfs_free_min_time_ms is the minimum number of milliseconds per TXG commit the freeing thread spends freeing blocks (default 1000 on OpenZFS 0.6 through 2.3). Lowering it gives each TXG back to foreground work sooner, at the cost of a slower drain:
# Gentler reclaim during business hours (runtime-only; resets on reboot)
echo 200 > /sys/module/zfs/parameters/zfs_free_min_time_ms
For the full hang case (all pool commands in D state after mass concurrent destroys), the reported unblock is setting it to 0, which stops the freeing thread from consuming TXG time; restoring the default resumes cleanup:
# Emergency unblock only - stops async destroy from consuming TXG time
echo 0 > /sys/module/zfs/parameters/zfs_free_min_time_ms
# Once the pool is responsive, restore it so reclaim resumes
echo 1000 > /sys/module/zfs/parameters/zfs_free_min_time_ms
This is a runtime module parameter change, not a destructive operation, but treat 0 as a temporary measure: with it set, the freeing backlog does not drain.
Speed the reclaim up when the pool can afford it
zfs_per_txg_dirty_frees_percent controls what percentage of the dirty-data budget (zfs_dirty_data_max) frees may consume in one TXG. Older releases shipped a conservative default of 5, which caused abysmal delete performance under load; OpenZFS 2.2.0 raised the default to 30. If you are on an affected version and the pool has I/O headroom, raising it makes reclaim finish sooner:
# Check first, then raise if you are on the old default
cat /sys/module/zfs/parameters/zfs_per_txg_dirty_frees_percent
echo 30 > /sys/module/zfs/parameters/zfs_per_txg_dirty_frees_percent
Do not raise this on a near-full pool. Frees consuming more dirty-data budget means foreground writes get throttled harder.
Near-full pool: relieve capacity pressure first
If CAP is above ~90%, async destroy is fighting the metaslab allocator for scraps. The death-spiral failure mode is that reclaiming space requires space and I/O, both of which are exhausted. In order:
- Reduce or pause foreground write load where possible. Every write you remove is I/O reclaim can use.
- Destroy a few large, old snapshots rather than everything at once. Each completed reclaim adds real free space that makes the next reclaim cheaper.
- Do not launch parallel
zfs destroy -rstorms. Serialize destroys; concurrency here has produced full pool hangs in the field. - If a scrub or resilver is running and the situation is urgent, consider whether it can wait; both compete for the same bandwidth.
Scripting around destroys
For automation, gate follow-up work on the backlog instead of guessing:
# Wait for reclaim to finish before the next destructive step,
# if your OpenZFS version supports it
zpool wait -t free <pool>
If your version lacks it, poll zpool get -Hp -o value freeing <pool> in a loop until it reads 0.
Prevention
- Stagger snapshot pruning. Retention jobs that destroy thousands of snapshots in one run create exactly the burst that stalls pools. Spread destroys across the maintenance window, and prune continuously rather than in monthly bulk runs.
- Alert on
freeing, not just CAP. A pool at 92% with a largefreeingbacklog is a different situation from a pool at 92% with none. Track the property as a first-class metric so a destroy started by someone else does not surprise you. - Keep capacity headroom. The 85% action threshold exists partly so that operations like large destroys remain cheap. A pool that lives above 90% turns every cleanup into an incident.
- Size destroys before running them.
zfs list -t snapshot -o name,used,refer -s used -r <pool>tells you what you are about to set in motion. A 5 TB snapshot destroy on a Friday afternoon is a choice. - Track snapshot-held space.
zfs get -r usedbysnapshots <pool>andzfs list -o space -r <pool>show how much of your pool is locked behind snapshots before it becomes an emergency.
How Netdata helps
- Freeing backlog as a time series: the
freeingpool property charted over time turns “the destroy seems slow” into a drain rate and an ETA, and catches destroys launched by other automation. - Correlation with pool latency: overlaying
freeingagainstzpool iostatread/write latency shows exactly when reclaim started impacting foreground I/O, separating destroy contention from device problems. - TXG and dirty-data context: TXG sync duration and dirty-data pressure alongside the backlog tell you whether the write pipeline is absorbing the reclaim or throttling applications because of it.
- Capacity trend in the same view: CAP, fragmentation, and snapshot space next to the freeing backlog let you see the death-spiral preconditions (near-full pool plus large pending reclaim) before writes start failing.






