falloc-fl-collapse-range · shipping · also collapse range, fallocate --collapse-range

FALLOC_FL_COLLAPSE_RANGE

The Linux collapse-range operation removes a byte range from a Linux file, shifts later data left and reduces the file size.

Transformation: removing length L at offset O moves the suffix beginning at O+L to O and subtracts L from logical length. Unlike hole punching, it leaves no gap. In a logical illustration of equal aligned chunks, removing B from ABCD produces ACD. [1]

Boundaries: O must be nonnegative, L positive and O+L strictly below the old EOF. Removing a suffix through EOF calls for truncation instead. Filesystem support and alignment are required; no other mode flag, including KEEP_SIZE, may accompany collapse. [2]

Interface: util-linux exposes --collapse-range (-c). Check failures without assigning one universal errno to rejected flag combinations: Linux v6.12 vfs_fallocate uses EOPNOTSUPP for conflicting modes. [3] [4]

Persistence: the logical range transformation does not specify media sanitization. [1] Synchronizing modified file data and required metadata is a separate concern. [5]

Observed offset trap: a bounded Linux/ext4 probe kept the open-file position at byte 8192 while collapse changed its next byte from C to D and insert from C to B. This is one environment, not a portability guarantee. [7]

Relations

related
FALLOC_FL_INSERT_RANGE, Hole punching, File size, File offset, File truncation

Citations

  1. Linux v6.12: fallocate range-mode contracts (accessed 2026-12-05)
  2. Linux man-pages: fallocate(2), range boundaries and mode restrictions (accessed 2026-12-05)
  3. util-linux v2.41.2: fallocate command options (accessed 2026-12-05)
  4. Linux v6.12: vfs_fallocate flag validation (accessed 2026-12-05)
  5. Linux man-pages: fsync(2), data and metadata synchronization (accessed 2026-12-05)
  6. Hesela: Native range transformation and cursor observation (accessed 2026-12-05)

Further reading

  1. Hesela: Sparse files, preallocation and thin-pool capacity (accessed 2026-12-05)
Sources & caveats
  • Primary-documentation synthesis with logical illustrations and a separately scoped native Linux/ext4 byte-and-cursor probe; not a performance or crash measurement.
  • Pinned Linux v6.12 and util-linux v2.41.2 sources do not establish support for every filesystem configuration.

JSON: /data/terms/falloc-fl-collapse-range.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. FALLOC_FL_COLLAPSE_RANGE. Hesela. 2026-12-05. https://hesela.dev/terms/falloc-fl-collapse-range/