{
  "slug": "btrfs-filesystem-du",
  "term": "Btrfs filesystem du",
  "aliases": [
    "btrfs filesystem du"
  ],
  "definition": "A Btrfs command that uses FIEMAP to report extent usage and sharing for selected files and directory trees.",
  "note": "For each file the command reports total and exclusive bytes. Each argument has its own accounting set, found by a recursive search that descends into subvolumes but not mount points, with overlapping shared ranges deduplicated within that set. A shared range can also be referenced outside it, so set-shared bytes do not establish deletion savings. [filesystem-manual]\n\nIn v6.16, UNKNOWN, DELALLOC and DATA_INLINE extents are skipped, and the FIEMAP requests do not set FIEMAP_FLAG_SYNC, so recently written data still awaiting allocation is not counted. Each request uses a 16,384-byte buffer, and zero-length extents produce a warning. Some inaccessible children generate warnings while traversal continues, so zero exit status alone does not establish coverage. [du-code]\n\nOn kernels older than 2.6.33 the command warns that shared space will be reported as exclusive, because the FIEMAP_EXTENT_SHARED flag is missing there. Hard-link detection is reset for each argument. [du-code]",
  "status": "shipping",
  "advantages": [
    {
      "text": "Sizes can be printed raw in bytes or scaled in base 1024 or SI base 1000 units.",
      "citationIds": [
        "filesystem-manual"
      ]
    }
  ],
  "limitations": [
    {
      "text": "A changing filesystem does not provide one atomic observation across the whole walk.",
      "citationIds": [
        "fiemap-interface"
      ]
    }
  ],
  "related": [
    "fiemap",
    "reflink",
    "file-extent",
    "filesystem-defragmentation",
    "transparent-compression"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-23",
  "citations": [
    {
      "id": "filesystem-manual",
      "title": "Btrfs-progs v6.16: filesystem du, per-argument sets and traversal scope",
      "url": "https://raw.githubusercontent.com/kdave/btrfs-progs/v6.16/Documentation/btrfs-filesystem.rst",
      "accessed": "2026-10-23"
    },
    {
      "id": "du-code",
      "title": "Btrfs-progs v6.16: filesystem-du.c, extent exclusions, set accounting and traversal warnings",
      "url": "https://raw.githubusercontent.com/kdave/btrfs-progs/v6.16/cmds/filesystem-du.c",
      "accessed": "2026-10-23"
    },
    {
      "id": "fiemap-interface",
      "title": "Linux FIEMAP documentation: request flags and mappings changing between calls",
      "url": "https://www.kernel.org/doc/html/latest/filesystems/fiemap.html",
      "accessed": "2026-10-23"
    },
    {
      "id": "hesela-clones",
      "title": "Hesela: file-clone costs and shared-space accounting",
      "url": "https://hesela.com/analyses/file-clones-deferred-copy-cost/#accounting",
      "accessed": "2026-10-16"
    }
  ],
  "provenance": [
    "Behavior is scoped to btrfs-progs v6.16 source, not a claim about every release.",
    "Source review only; no Btrfs filesystem or compression experiment is reported.",
    "filesystem-manual is the btrfs-progs v6.16 btrfs-filesystem documentation, re-read for du output fields, the set definition and size options.",
    "du-code is btrfs-progs v6.16 cmds/filesystem-du.c, re-read for skipped extent flags, buffer size, the kernel version warning and hard-link reset.",
    "fiemap-interface is the Linux 7.3 FIEMAP documentation, re-read for request flags, byte units and mappings changing between calls.",
    "The filesystem-defragmentation entry links here because Btrfs defragmentation can break up reflinks and so change the shared and exclusive bytes this command reports."
  ]
}
