file-size · shipping · also logical file size, file length

File size

A regular file's logical size is its length in bytes, including holes, rather than the space allocated to store it.

On Linux, st_size reports regular-file length in bytes. st_blocks counts allocated 512-byte units, while st_blksize is a preferred I/O size, not the multiplier for that count. Neither field directly measures a lower thin pool's consumption. These regular-file meanings must not be applied to pipe buffers or device capacity. [1] [5]

The file offset is a position, not a length. lseek can move it beyond EOF without growing the file; writing there can extend the file and leave a zero-reading gap. FALLOC_FL_KEEP_SIZE can instead allocate beyond EOF without increasing st_size. Allocation, length and cursor position can therefore change independently. [2] [3]

A status call does not freeze file contents. Linux permits different returned fields to reflect different moments during concurrent changes. An observed length is not a promise that a later read will see the same file state. [4]

Relations

related
End of file, File offset, Regular file, Sparse file, File truncation

Limitations

  • Logical length does not establish physical allocation, content identity or durability.

Citations

  1. Linux man-pages: inode(7), size and allocation fields (accessed 2026-11-15)
  2. Linux man-pages: lseek(2), cursor movement and file growth (accessed 2026-11-15)
  3. Linux man-pages: fallocate(2), KEEP_SIZE allocation (accessed 2026-11-15)
  4. Linux man-pages: stat(2), concurrent metadata observations (accessed 2026-11-15)
  5. Hesela: File length, EOF and zero bytes (accessed 2026-11-15)
Sources & caveats
  • Primary-documentation synthesis for regular-file accounting, not a new allocation or crash experiment.

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

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

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