Pcornel
Browse topics
Options
Recent
Favorites
Storage · Technical reference

ZSTD

Direct answer

ZSTD (Zstandard) is a lossless compression algorithm with adjustable levels, giving better ratios than LZ4 at moderate CPU cost. It is used in ZFS, Btrfs, backup tools and Linux kernels.

First 30 seconds

1. ZSTD: better ratio than LZ4, tunable levels.

2. Low levels (1–3) are fast.

3. Higher levels for archives.

4. Decompression stays fast.

5. Use for backups/logs.

Operational verification

data → ZSTD level n → 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 better compression ratio is worth more CPU.
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
  • High levels on write-heavy workloads.
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
  • ZSTD has adjustable levels.
  • Higher levels give better ratio and cost CPU.
  • Good for backups and archives.
Key checks
  • zfs set compression=zstd-3 <ds> — ZFS zstd level
  • zstd -b3 -e9 <file> — benchmark levels
  • mount -o compress=zstd:3 — Btrfs
ReferenceHow it works1 section · depth on demand

Reference

zfs set compression=zstd-3 tank/archive
zstd -b1 -e10 file      # benchmark levels 1-10
ReferenceImportant terms & boundaries3 sections · depth on demand

In depth

ZSTD trades more CPU for better compression than LZ4

zfsprops(7) lists zstd, zstd-N (levels 1–19) and zstd-fast/zstd-fast-N among the compression values. As with every compression setting, changing it affects only newly written data.

# zfs set compression=zstd tank/archive          # zstd default level
# zfs set compression=zstd-9 tank/cold
# zfs set compression=zstd-fast tank/logs
# zfs get -r compression,compressratio tank
NAME          PROPERTY       VALUE      SOURCE
tank/archive  compression    zstd       local
tank/archive  compressratio  2.41x      -
tank/data     compression    lz4        local
tank/data     compressratio  1.58x      -

Choosing a level

SettingTypical use
lz4General purpose and VMs: lowest CPU
zstd-fastLogs and text, close to LZ4 speed
zstd (default level)Archives, backups, file shares
zstd-9 and higherCold data written once; writes become CPU-bound

Practical points

  • Higher levels mainly cost CPU on writes. Decompression stays fast across levels.
  • Mixed datasets are fine: set compression per dataset (tank/archive zstd, tank/vm lz4).
  • zstd requires the zstd_compress pool feature, so older pools or systems may not support it. Check with zpool get feature@zstd_compress.
  • Replication with zfs send -c keeps blocks compressed in the stream. The receiver stores them as sent.

Measure, don't guess

Copy a representative sample into test datasets with different settings and compare compressratio and write time. The right choice depends on data type and CPU headroom.

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.

Quick reference

LevelSpeedRatioUse
zstd-1…3Close to LZ4Better than LZ4General data
zstd-9…12SlowerHigherArchives, cold data
zstd-19Very slowHighestWrite-once archives

Decompression stays fast at all levels, so high levels mainly cost write speed. ZFS: zfs set compression=zstd-3 tank/data; Btrfs: mount -o compress=zstd:3.

Reference

ZSTD offers levels (1–19, plus negative fast levels). Level 1–3 is close to LZ4 speed with better ratio; high levels suit archives. Supported in ZFS (2.0+), Btrfs, Linux kernels and many backup tools.

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 → ZSTD. 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?