Use this when measuring how much compression actually saves.
Compression Ratio
Compression ratio is original size divided by compressed size, for example 2:1 means data takes half the space. Check it per dataset or volume (zfs get compressratio) to see where compression pays off.
1. Compression ratio = uncompressed / compressed.
2. Text/logs high; media/encrypted about 1.0.
3. Plan capacity with measured ratios.
4. Ratios vary per dataset.
5. Report per workload.
logical ÷ physical → ratio
Context & applicabilityCommon mistakes · platform/version boundaries
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 Common mistakes Narrow the fault
- Comparing ratios across different tools.
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.
- 2:1 means data uses half the space.
- Ratio varies by dataset.
- Measure on real data.
zfs get compressratio,logicalused,used <ds>— ratiocompsize <path>— Btrfsarray report— compression ratio
ReferenceHow it works1 section · depth on demand
Reference
zfs get used,logicalused,compressratio tank/data
ReferenceImportant terms & boundaries4 sections · depth on demand
In depth
Compression ratio: logical size divided by physical size
Compression ratio = logical (uncompressed) data ÷ physical space used. A 2.0× ratio means data takes half the space.
Reading it in ZFS
zfsprops(7) describes compressratio as the compression achieved for a dataset's used space (for snapshots, the same as refcompressratio). It also explains that blocks are allocated in whole sectors, so a block whose compression saves less than one sector is stored uncompressed. Zero-filled blocks are stored as holes when compression is on.
# zfs get -o name,property,value compressratio,refcompressratio,logicalused,used tank/data
NAME PROPERTY VALUE
tank/data compressratio 1.74x
tank/data refcompressratio 1.69x
tank/data logicalused 2.61T
tank/data used 1.50T
Ratio versus savings
| Ratio | Space saved |
|---|---|
| 1.25× | 20 % |
| 1.5× | 33 % |
| 2.0× | 50 % |
| 3.0× | 67 % |
Typical ratios by content (rough)
| Data | Usual range |
|---|---|
| Text, logs, source code, JSON | 2–5× |
| Databases | 1.5–3× |
| VM images (OS and apps) | 1.3–2× |
| JPEG, MP4, ZIP, encrypted data | ~1.0× |
Pitfalls when reporting
- Large sector sizes (ashift=12, 4 KiB) limit savings for small blocks, because compressed data still rounds up to whole sectors.
- Vendors often report "data reduction" as compression, dedup and thin provisioning combined. Ask for each figure separately.
- The ratio applies only to data written since compression was enabled. Old data keeps its original form until rewritten.
Documented example, not captured output.
How it works
The ratio is uncompressed size ÷ compressed size, reported per volume or dataset. It changes with the data written, so trend it over time.
Reference
Ratio = logical size ÷ compressed size. Check with zfs get compressratio, compsize /data (Btrfs) or array reports. Typical: databases 1.5–3×, logs 5×+, media ~1×.
Worked example
Example: zfs get used,logicalused,compressratio tank/logs → logicalused 300G, used 60G, ratio 5.00x. The pool stores 60 GB on disk for 300 GB of logical data.
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 Compression → Compression Ratio. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html · confidence 94%