Use this to understand what compression can and cannot save on storage.
Compression Fundamentals
Compression replaces repeated patterns in data with shorter codes. Storage systems use lossless algorithms, and the saving depends on the data: text, logs and databases compress well, media and encrypted data do not.
1. Compression trades CPU for space and I/O.
2. Algorithms: LZ4 (fast), ZSTD (tunable), gzip (slow).
3. Applies to new writes.
4. Check ratio per dataset.
5. Avoid double compression.
data → compression algorithm → stored
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
- Expecting savings on encrypted data.
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.
- Text, logs and databases compress well.
- Media, archives and encrypted data do not.
- Lossless compression returns data exactly.
zfs get compression,compressratio <ds>— ZFScompsize <path>— Btrfs actualgzip -l <file>— file ratio
ReferenceHow it works1 section · depth on demand
Reference
| Data | Typical ratio |
|---|---|
| Text/logs | 4–10× |
| Databases | 1.5–3× |
| VM disks | 1.3–2× |
| Media/archives | ~1× |
ReferenceImportant terms & boundaries2 sections · depth on demand
How it works
Lossless compression finds repeated patterns and encodes them more compactly. Text and logs compress well; already compressed or encrypted data does not.
Reference
Compression shrinks data before it is written. Fast algorithms often increase throughput because less data hits disk. Already-compressed data (media, archives, encrypted data) does not shrink.
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 Fundamentals. 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%