Sparse file
A file with unallocated ranges that read as zeros, allowing its logical size to exceed its allocated storage.
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.
Relations
- related
- file-storage, hole-punching, file-preallocation, thin-provisioning, file-extent, unwritten-extent
Advantages
- Unwritten gaps can be represented without allocating data blocks for the entire logical range. [1, 2]
Limitations
- Zeros returned by a read do not prove that the corresponding range is a hole. [1]
- Filesystem allocation is not a direct measurement of underlying thin-pool capacity. [2, 3]