Btrfs balance
Btrfs balance relocates selected block groups on a mounted filesystem according to allocation-profile constraints.
Balance preserves shared extents; it neither defragments nor recompresses files. Filters can select groups for compaction or profile conversion. [1]
Relocation usually needs a new block group before releasing the old one. Its workspace ENOSPC is therefore distinct from exhausted file space. The usage=0 case reclaims entirely unused groups without allocating that workspace, but is not a guaranteed remedy for every ENOSPC. [2]
In btrfs filesystem df, total is capacity already allocated to a block-group type/profile and used is occupied space within it. Their difference is not device-unallocated workspace. File defragmentation can break reflinks and increase allocation; balance preserves sharing. [3]
Scrub checks checksums and read errors, with repair dependent on known-good replicas. It is not a full filesystem checker; NODATASUM file payload lacks data-checksum validation. Read-only scrub on a read-write filesystem can still cause filesystem writes; the documented no-write combination requires both read-only scrub and a read-only filesystem. This is a mount-mode boundary, not a claim that every checksum scan is write-free. [4]
The design paper explains sharing-preserving relocation through back references and copy-on-write relocation trees, merged with active trees after pointer updates. Its historical benchmarks do not establish a present-day balance speedup. [5]
Relations
Advantages
Limitations
- An unfiltered balance can move data and metadata across the filesystem and compete with applications for I/O. [1]
Citations
- Btrfs-progs v6.16: balance purpose, extent sharing and I/O costs
- Btrfs-progs v6.16: balance ENOSPC and empty-block-group exception
- Btrfs-progs v6.16: filesystem df allocation counters and defragmentation
- Btrfs-progs v6.16: scrub verification, replica repair and NODATASUM limits
- Rodeh, Bacik and Mason (2013): BTRFS, Section 5 (author manuscript)
Further reading
Sources & caveats
- Source review of btrfs-progs v6.16 documentation, accessed 2026-11-29; not a native filesystem experiment or performance measurement.
- Kernel and tool versions, allocation profiles and device layout remain relevant to an actual maintenance plan.
- Historical mechanism checked against the author manuscript, Section 5; DOI 10.1145/2501620.2501623. Operational statements remain scoped to btrfs-progs v6.16 documentation.