Concepts

Sample size

One sample is one logical offset chosen at random by btdu. Because we know the total size of the filesystem, we can divide this size by the total number of samples to obtain the approximate size of how much data one sample represents. (This size is also shown at the bottom as "Resolution".)

Confidence

For the represented and exclusive size, btdu displays a confidence range, e.g.:

- Represented size: ~763.0 GiB (6006 samples), ±16.9 GiB

This should be interpreted as: given the data btdu collected so far, it is confident with 95% certainty that the object size is within 16.9 GiB of 763.0 GiB.

Logical vs. physical space

Quoting On-disk format:

Btrfs makes a distinction between logical and physical addresses. Logical addresses are used in the filesystem structures, while physical addresses are simply byte offsets on a disk. One logical address may correspond to physical addresses on any number of disks, depending on RAID settings.

In this regard, btdu has two modes of operation:

In physical space mode, btdu will also show unallocated space (represented as an <UNALLOCATED> node in the hierarchy root) and any device slack (represented as a <SLACK> node).

Logical space mode is the default. To use physical space mode, run btdu with --physical (-p).

Representative location

After picking a logical offset to sample, btdu asks btrfs what is located at that offset. btrfs replies with zero or more locations. Out of these locations, btdu picks one location where it should place the sample within its tree, to represent the space occupied by this data. We call this location the representative location.

The way in which btdu selects the representative location aims to prefer better visualization of what the data is used for, i.e., the simplest explanation for what is using this disk space. For instance, if one location's filesystem path is longer than the other, then the shorter is chosen, as the longer is more likely to point at a snapshot or other redundant clone of the shorter one.

Examples:

Size metrics

In --expert mode, btdu shows four size metrics for tree nodes:

As an illustration, consider a file consisting of unique data (dd if=/dev/urandom of=a bs=1M count=1):

Here is what happens if we clone the file (cp --reflink=always a b):

Finally, here is what the sizes would look like for two 2M files which share 1M. Note how the represented size adds up to 3M, the total size of the underlying data.