Use it when configuring, checking or troubleshooting Compression in ZFS.
Compression · ZFS
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.
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.
write → compress → fewer blocks
Context & applicabilityCommon mistakes · platform/version boundaries
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.
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
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 · 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.
- 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.
zfs get compression,compressratio <ds>— setting and ratiozfs set compression=lz4 <ds>— enable lz4zfs 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.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
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%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.
Quick lookup tables
ZFS → Compression ZFS map
Fast topology, capacity, integrity and proof boundaries for ZFS → Compression.
| ZFS boundary | What to verify | Proof limit |
|---|---|---|
| Identity / topology | Pool GUID/name, dataset/zvol, top-level vdev class, leaf-device identity and effective properties | Object presence alone does not prove integrity, performance or recovery |
| Capacity / protection | Pool free space, quotas/reservations, snapshot retention, redundancy and active scrub/resilver state | Free space or ONLINE state at one layer does not prove end-to-end health |
| Failure boundary | A 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 |
| Acceptance | Healthy 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 |