Pcornel
Browse topics
Options
Recent
Favorites
Storage · Technical reference

Compression · ZFS

Direct answer

ZFS can compress blocks before writing them and stores the compressed representation when beneficial according to the selected algorithm/policy. Compression can reduce physical I/O and capacity consumption, sometimes improving performance, but CPU cost and workload compressibility matter. Existing blocks keep their old representation until rewritten.

When to use this

Use it when configuring, checking or troubleshooting Compression in ZFS.

First 30 seconds

1. Compression (lz4/zstd) saves space and often speeds I/O.

2. lz4 is almost free; zstd for better ratios.

3. Only new writes are compressed.

4. Already compressed data won't shrink.

5. Enable by default on pools.

Operational verification

write → compress → fewer blocks

Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Failure and recovery traps

A reported compression ratio shows a relationship between logical and stored representation for covered data, but it does not show CPU cost, future ratios or application performance.

Suspicious evidence: property change is assumed retroactive, logical size is mistaken for physical use, or maximum compression ratio is prioritized without workload/CPU measurement.

Platform / version applicability
ZFS storage
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformZFS storage
Scope / prerequisiteUse it when configuring, checking or troubleshooting Compression in ZFS.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

1 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Verification path Verify boundary

application write → ZFS block → compression decision → checksum → physical allocation → vdev write → read/decompress/checksum

Healthy evidence: selected compression policy matches workload, physical I/O/allocation improves or remains acceptable, CPU headroom exists, and representative reads/writes are correct.

Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Compression ≠ deduplication.
  • Logical dataset size ≠ physical allocated bytes with compression.
  • Changing compression property ≠ recompressing all existing data immediately.
  • Higher compression ratio ≠ automatically lower application latency.
Key checks
  • zfs get compression,compressratio <ds> — setting and ratio
  • zfs set compression=lz4 <ds> — enable lz4
  • zfs set compression=zstd <ds> — stronger compression
ReferenceImportant terms & boundaries2 sections · depth on demand

Topology

A reported compression ratio shows a relationship between logical and stored representation for covered data, but it does not show CPU cost, future ratios or application performance.

In depth

Compression is applied per record before writing and costs little CPU with LZ4 or low zstd levels, so compression=lz4 (or zstd) is a sensible default for every dataset. Incompressible data is detected early and stored uncompressed.

zfs set compression=lz4 tank
zfs get compressratio,used,logicalused tank/vm

Compression also reduces I/O: reading 128K of logical data that compressed to 40K moves only 40K from disk. Data written before compression was enabled stays uncompressed until rewritten.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docZFS storage current

Authoritative/upstream documentation reviewed for bounded claims in ZFS → Compression. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://openzfs.github.io/openzfs-docs/ · confidence 94%
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
zfs compressioncompressioncompressratio
Embedded reference data

Quick lookup tables

ZFS → Compression ZFS map

Fast topology, capacity, integrity and proof boundaries for ZFS → Compression.

ZFS boundaryWhat to verifyProof limit
Identity / topologyPool GUID/name, dataset/zvol, top-level vdev class, leaf-device identity and effective propertiesObject presence alone does not prove integrity, performance or recovery
Capacity / protectionPool free space, quotas/reservations, snapshot retention, redundancy and active scrub/resilver stateFree space or ONLINE state at one layer does not prove end-to-end health
Failure boundaryA reported compression ratio proves a relationship between logical and stored representation for covered data; it does not prove CPU cost, future ratios or application performance.Correlate ZFS evidence with both workload and lower device/path evidence
AcceptanceHealthy evidence: selected compression policy matches workload, physical I/O/allocation improves or remains acceptable, CPU headroom exists, and representative reads/writes are correct.Close only after original workload plus checksum/read-back/recovery verification succeeds
Confirmation

Confirm action

Continue?