Use this when deciding whether to compress a pool, volume or backup and which algorithm to use, or when compression saves less than expected.
Compression
Storage compression encodes data in fewer bytes, usually with fast algorithms like LZ4 or ZSTD, to save capacity and sometimes speed up I/O. Already compressed or encrypted data gains little.
1. Compression reduces stored size.
2. Usually cheap with LZ4/ZSTD.
3. Already-compressed data gains nothing.
4. Often improves throughput.
5. Enable by default on modern filesystems.
write → compress → fewer blocks
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
- Using gzip-9 on busy systems.
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.
Subtopics
Go one level deeper into this subject.
Compression replaces repeated patterns in data with shorter codes.
Subtopic Inline CompressionInline compression compresses data as it is written, before it reaches disk, so the saving is immediate and fewer bytes are written.
Subtopic Compression RatioCompression ratio is original size divided by compressed size, for example 2:1 means data takes half the space.
Subtopic LZ4LZ4 is a very fast lossless compression algorithm with modest ratios.
Subtopic ZSTDZSTD (Zstandard) is a lossless compression algorithm with adjustable levels, giving better ratios than LZ4 at moderate CPU cost.
Subtopic Compression PerformanceCompression performance is the CPU cost and speed of compressing and decompressing data.
- Compression happens before deduplication and encryption in most systems.
- Already compressed or encrypted data does not shrink.
- Fast algorithms can increase throughput by writing fewer bytes.
zfs get compressratio <ds>— ZFS ratiobtrfs filesystem du / compsize <path>— BtrfsGet-Volume (compression attribute)— NTFS compression
ReferenceHow it works1 section · depth on demand
Reference
zfs get compression,compressratio tank
compsize /data # Btrfs
ReferenceImportant terms & boundaries2 sections · depth on demand
How it works
Compression encodes data with fewer bits. Storage systems compress per block or record; if a block does not shrink enough, it is stored uncompressed.
Reference
| Algorithm | Speed | Ratio | Use |
|---|---|---|---|
| LZ4 | Very fast | Moderate | Default on ZFS, general |
| ZSTD | Fast–slow (levels) | High | Archives, backups, Btrfs/ZFS |
| GZIP | Slow | Good | Legacy |
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. 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%