{
  "slug": "transparent-compression",
  "term": "Transparent filesystem compression",
  "aliases": [
    "Transparent compression"
  ],
  "status": "shipping",
  "advantages": [
    {
      "text": "Applications keep reading and writing the original bytes, and one filesystem can hold uncompressed files next to files compressed with different algorithms.",
      "citationIds": [
        "btrfs-compression"
      ]
    }
  ],
  "limitations": [
    {
      "text": "Files touched by fallocate are excluded from Btrfs compression even with compress-force, because preallocated space must guarantee that later writes do not fail.",
      "citationIds": [
        "btrfs-compression"
      ]
    },
    {
      "text": "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.",
      "citationIds": [
        "btrfs-compression"
      ]
    },
    {
      "text": "Higher levels use more CPU time and memory and may not shrink the data significantly further.",
      "citationIds": [
        "btrfs-compression"
      ]
    }
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-17",
  "definition": "Filesystem-managed compression of eligible file data that preserves the original logical bytes exposed to applications.",
  "note": "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. [btrfs-compression]\n\nIn 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. [zfsprops]",
  "related": [
    "reflink",
    "filesystem-defragmentation",
    "copy-on-write",
    "file-extent",
    "lossless-compression",
    "compression-ratio"
  ],
  "citations": [
    {
      "id": "btrfs-compression",
      "title": "Btrfs-progs v6.16: Compression chapter, algorithms, levels, exceptions and incompressible data",
      "url": "https://raw.githubusercontent.com/kdave/btrfs-progs/v6.16/Documentation/ch-compression.rst",
      "accessed": "2026-10-23"
    },
    {
      "id": "hesela-clones",
      "title": "Hesela: Fast file clones and deferred copying costs",
      "url": "https://hesela.com/analyses/file-clones-deferred-copy-cost/",
      "accessed": "2026-10-16"
    },
    {
      "id": "zfsprops",
      "title": "OpenZFS zfs-2.3.4: zfsprops(7), compression property, sector rounding and threshold.",
      "url": "https://github.com/openzfs/zfs/blob/zfs-2.3.4/man/man7/zfsprops.7",
      "accessed": "2026-10-23"
    }
  ],
  "provenance": [
    "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."
  ]
}
