{
  "slug": "sparse-file",
  "term": "Sparse file",
  "aliases": [],
  "definition": "A file with unallocated ranges that read as zeros, allowing its logical size to exceed its allocated storage.",
  "note": "On Linux, seeking past EOF alone does not extend a file; writing there leaves a zero-reading gap. SEEK_DATA and SEEK_HOLE are not exact physical allocation maps because filesystems may conservatively report every offset as data. Linux st_blocks counts 512-byte units; st_blksize is a preferred I/O size, not that count's unit.",
  "status": "shipping",
  "advantages": [
    {
      "text": "Unwritten gaps can be represented without allocating data blocks for the entire logical range.",
      "citationIds": [
        "lseek",
        "inode"
      ]
    }
  ],
  "limitations": [
    {
      "text": "Zeros returned by a read do not prove that the corresponding range is a hole.",
      "citationIds": [
        "lseek"
      ]
    },
    {
      "text": "Filesystem allocation is not a direct measurement of underlying thin-pool capacity.",
      "citationIds": [
        "inode",
        "lvmthin"
      ]
    }
  ],
  "related": [
    "file-storage",
    "hole-punching",
    "file-preallocation",
    "thin-provisioning",
    "file-extent",
    "unwritten-extent"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-13",
  "citations": [
    {
      "id": "lseek",
      "title": "Linux man-pages: lseek(2), holes and SEEK_DATA/SEEK_HOLE",
      "url": "https://www.man7.org/linux/man-pages/man2/lseek.2.html",
      "accessed": "2026-10-12"
    },
    {
      "id": "inode",
      "title": "Linux man-pages: inode(7), file size and allocated blocks",
      "url": "https://man7.org/linux/man-pages/man7/inode.7.html",
      "accessed": "2026-10-12"
    },
    {
      "id": "lvmthin",
      "title": "LVM2: lvmthin(7), physical allocation, discards and pool exhaustion",
      "url": "https://man7.org/linux/man-pages/man7/lvmthin.7.html",
      "accessed": "2026-10-12"
    },
    {
      "id": "hesela-allocation",
      "title": "Sparse files, preallocation and thin-pool capacity",
      "url": "https://hesela.com/analyses/sparse-files-preallocation-thin-capacity/",
      "accessed": "2026-10-13"
    }
  ]
}
