Pcornel
Browse topics
Options
Recent
Favorites
Storage · Technical reference

Inline Compression

Direct answer

Inline compression compresses data as it is written, before it reaches disk, so the saving is immediate and fewer bytes are written. It costs CPU on the write path, unlike post-process compression.

When to use this

Use this when compression happens on the write path.

First 30 seconds

1. Inline compression happens at write time.

2. Saves space immediately; may reduce I/O.

3. Fast algorithms keep latency low.

4. Monitor CPU.

5. Default on many arrays and filesystems.

Operational verification

write → compress inline → stored

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Storage architecture and operations
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.

PlatformStorage architecture and operations
Scope / prerequisiteUse this when compression happens on the write path.
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 Common mistakes Narrow the fault
  • Changing compression and expecting existing data to be recompressed (only new writes are).
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
  • Savings are immediate.
  • Fewer bytes are written to disk.
  • It adds CPU on every write.
Key checks
  • zfs set compression=lz4 <ds> — inline ZFS
  • mount -o compress=zstd:3 <dev> <mnt> — Btrfs inline
  • array inline compression — vendor
ReferenceHow it works1 section · depth on demand

Reference

Inline compression happens before writing, so it reduces disk I/O and capacity. It is the default recommendation on ZFS (lz4/zstd) and many arrays.

ReferenceImportant terms & boundaries3 sections · depth on demand

In depth

Inline compression compresses data in the write path, before it reaches disk

With inline compression, each block is compressed as it is written. There is never an uncompressed copy on disk. Post-process compression (some dedup systems, some arrays) writes data first and compresses it later in background jobs.

AspectInlinePost-process
Space savedImmediatelyAfter the job runs
CPUOn every writeIn scheduled windows
Write latencySmall extra costNone at write time
Disk writesFewer bytes writtenFull writes, then rewrites

ZFS compresses inline

zfsprops(7) lists the compression algorithms (lz4, zstd, gzip-N and others) and notes that changing the property affects only newly written data. Blocks are allocated in whole sectors; if compression doesn't save at least one sector, the block is stored uncompressed.

# zfs set compression=lz4 tank/vm
# zfs get compression,compressratio tank/vm
# zpool iostat -v tank 5        # fewer bytes written than the application sends

Where inline compression sits in the stack

LayerExamples
File systemZFS, Btrfs (compress=zstd), NTFS compression
Block layerVDO (Linux), array inline compression
ApplicationDatabase page or column compression, compressed backups

When it helps performance

On fast CPUs with LZ4 or ZSTD-fast, inline compression often makes storage faster, because fewer bytes are read and written. The exceptions are CPU-bound hosts, already-compressed data (little gain, small cost) and very high compression levels on write-heavy data.

Avoid compressing twice

Don't stack compression layers (application, then VDO, then array) without measuring. Data compressed once gains almost nothing the second time, but still pays the CPU cost.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

How it works

Data is compressed before it is written, reducing both capacity used and disk writes. Fast algorithms like LZ4 often make writes faster because less data reaches the disks.

Reference

zfs set compression=lz4 tank/data
zfs get compressratio tank/data
mount -o compress=zstd:3 /dev/sdb /data      # Btrfs

Documented example, not captured output.

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 docStorage architecture and operations current

Authoritative/upstream documentation reviewed for bounded claims in Compression → Inline 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%
Confirmation

Confirm action

Continue?