transparent-compression · shipping · also Transparent compression

Transparent filesystem compression

Filesystem-managed compression of eligible file data that preserves the original logical bytes exposed to applications.

In Btrfs, compression works on file extents, and data are split into 128 KiB chunks before compression so that random rewrites avoid a large penalty, at the cost of more extents and metadata. Changing compression policy affects new writes, leaving existing data untouched, and an algorithm chosen for a defragmentation run applies to that run only. Zstandard levels range from -15 to 15 and zlib levels from 1 to 9, with level 3 as the default for both. Attempting compression is not a guarantee that each block is stored compressed: even compress-force may retain an uncompressed representation. [1]

In OpenZFS, blocks are allocated in whole sectors of 2^ashift bytes, so a block that saves less than one sector is stored uncompressed, and a 12.5% default threshold applies in addition. With a 16 KiB record size and 4 KiB sectors, compression must save at least 25% to reduce space on disk. Zero-filled blocks are stored as holes instead of being compressed. [3]

Relations

related
Reflink, Filesystem defragmentation, Copy-on-write (storage), File extent, Lossless compression, Compression ratio

Advantages

  • Applications keep reading and writing the original bytes, and one filesystem can hold uncompressed files next to files compressed with different algorithms. [1]

Limitations

  • Files touched by fallocate are excluded from Btrfs compression even with compress-force, because preallocated space must guarantee that later writes do not fail. [1]
  • If the first compressed portion of a Btrfs file is not smaller than the original, the file is marked NOCOMPRESS and is not compressed again unless forced. [1]
  • Higher levels use more CPU time and memory and may not shrink the data significantly further. [1]

Citations

  1. Btrfs-progs v6.16: Compression chapter, algorithms, levels, exceptions and incompressible data (accessed 2026-10-23)
  2. OpenZFS zfs-2.3.4: zfsprops(7), compression property, sector rounding and threshold. (accessed 2026-10-23)

Further reading

  1. Hesela: Fast file clones and deferred copying costs (accessed 2026-10-16)
Sources & caveats
  • btrfs-compression is the btrfs-progs v6.16 compression chapter, re-read for chunk size, levels, exceptions and incompressible data.
  • zfsprops is the OpenZFS zfs-2.3.4 zfsprops(7) manual page, read for the compression property, sector rounding and the default threshold.
  • No compression ratio or throughput measurement is claimed.

JSON: /data/terms/transparent-compression.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Transparent filesystem compression. Hesela. 2026-11-17. https://hesela.dev/terms/transparent-compression/