file-preallocation · shipping · also file space reservation

File preallocation

Reserving filesystem allocation for a file range before the application writes that range's data.

Successful Linux fallocate with mode 0 protects subsequent writes in the allocated range against lack of filesystem space; KEEP_SIZE avoids extending logical length. This is not just an advisory hint. A lower thin pool can still require backing allocations when data is written: an end-to-end capacity reservation is not established by the file operation alone, an inference from the separate layer contracts. Shared extents need an explicit sharing-aware contract; FALLOC_FL_UNSHARE_RANGE can make them private where supported.

On Windows, changing file size and advancing valid data length are distinct operations. SetFileValidData can expose bytes without initializing them; it is not an interchangeable zero-initializing reservation primitive. [7] [6]

Relations

related
Sparse file, Hole punching, Thin provisioning, fsync, File extent, Unwritten extent, Reflink, Delayed allocation, posix_fallocate, statvfs, Filesystem quota, Swapfile, FALLOC_FL_UNSHARE_RANGE, SetFileValidData

Advantages

  • Reserves a selected range before later application writes need its filesystem allocation. [1]

Limitations

  • Allocation is not proof that future application data has been persisted. [2]
  • The fallocate interface also has deallocation and zeroing modes, so the API name alone does not identify preallocation. [1]
  • glibc's posix_fallocate fallback can race concurrent writers when native allocation is unsupported; API choice and error handling matter. [5]

Citations

  1. Linux man-pages: fallocate(2), allocation and mode contracts (accessed 2026-10-12)
  2. util-linux 2.41.2: fallocate(1), preallocation, punching and zeroing (accessed 2026-10-12)
  3. Linux man-pages: posix_fallocate(3), return convention and glibc caveats (accessed 2026-10-16)
  4. Microsoft Learn: SetFileValidData, privilege requirements and stale-content disclosure (accessed 2026-11-29)
  5. Microsoft Learn: SetEndOfFile, file size versus valid data length (accessed 2026-11-29)

Further reading

  1. LVM2: lvmthin(7), physical allocation, discards and pool exhaustion (accessed 2026-10-12)
  2. Sparse files, preallocation and thin-pool capacity (accessed 2026-10-13)

JSON: /data/terms/file-preallocation.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. File preallocation. Hesela. 2026-11-29. https://hesela.dev/terms/file-preallocation/