{
  "slug": "file-size",
  "term": "File size",
  "aliases": [
    "logical file size",
    "file length"
  ],
  "definition": "A regular file's logical size is its length in bytes, including holes, rather than the space allocated to store it.",
  "note": "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. [inode] [hesela-capacity]\n\nThe 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. [lseek] [fallocate]\n\nA 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. [stat]",
  "status": "shipping",
  "advantages": [],
  "limitations": [
    "Logical length does not establish physical allocation, content identity or durability."
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-15",
  "related": [
    "end-of-file",
    "file-offset",
    "regular-file",
    "sparse-file",
    "file-truncation"
  ],
  "citations": [
    {
      "id": "inode",
      "title": "Linux man-pages: inode(7), size and allocation fields",
      "url": "https://man7.org/linux/man-pages/man7/inode.7.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "lseek",
      "title": "Linux man-pages: lseek(2), cursor movement and file growth",
      "url": "https://man7.org/linux/man-pages/man2/lseek.2.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "fallocate",
      "title": "Linux man-pages: fallocate(2), KEEP_SIZE allocation",
      "url": "https://man7.org/linux/man-pages/man2/fallocate.2.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "stat",
      "title": "Linux man-pages: stat(2), concurrent metadata observations",
      "url": "https://man7.org/linux/man-pages/man2/stat.2.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "hesela-capacity",
      "title": "Hesela: File length, EOF and zero bytes",
      "url": "https://hesela.com/analyses/sparse-files-preallocation-thin-capacity/#file-size-eof",
      "accessed": "2026-11-15"
    }
  ],
  "provenance": [
    "Primary-documentation synthesis for regular-file accounting, not a new allocation or crash experiment."
  ]
}
