btrfs-filesystem-du · shipping · also btrfs filesystem du

Btrfs filesystem du

A Btrfs command that uses FIEMAP to report extent usage and sharing for selected files and directory trees.

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. [1]

In 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. [2]

On 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. [2]

Relations

related
FIEMAP, Reflink, File extent, Filesystem defragmentation, Transparent filesystem compression

Advantages

  • Sizes can be printed raw in bytes or scaled in base 1024 or SI base 1000 units. [1]

Limitations

  • A changing filesystem does not provide one atomic observation across the whole walk. [3]

Citations

  1. Btrfs-progs v6.16: filesystem du, per-argument sets and traversal scope (accessed 2026-10-23)
  2. Btrfs-progs v6.16: filesystem-du.c, extent exclusions, set accounting and traversal warnings (accessed 2026-10-23)
  3. Linux FIEMAP documentation: request flags and mappings changing between calls (accessed 2026-10-23)

Further reading

  1. Hesela: file-clone costs and shared-space accounting (accessed 2026-10-16)
Sources & caveats
  • 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.

JSON: /data/terms/btrfs-filesystem-du.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Btrfs filesystem du. Hesela. 2026-10-23. https://hesela.dev/terms/btrfs-filesystem-du/