Sparse file

A sparse file: The empty bytes do not need to be saved and can be represented instead by metadata.

In computer science, a sparse file is a type of computer file that attempts to use file system space more efficiently when the file itself is partially empty. This is achieved by writing brief information (metadata) representing the empty blocks to the data storage media instead of the actual "empty" space which makes up the block, thus consuming less storage space. The full block is written to the media as the actual size only when the block contains "real" (non-empty) data.

Most commonly, sparse files are created when blocks of the file are never written to. This is typical for random-access files like databases. Some operating systems or utilities go further by "sparsifying" files when writing or copying them: if a block contains only null bytes, it is not written to storage but rather marked as empty.

When reading sparse files, the file system transparently converts metadata representing empty blocks into "real" blocks filled with null bytes at runtime. The application is unaware of this conversion.

Most modern file systems support sparse files, including most Unix variants and NTFS.[1] Apple's HFS+ does not provide support for sparse files, but in OS X, the virtual file system layer supports storing them in any supported file system, including HFS+.[citation needed] Apple File System (APFS) also supports them.[2] Sparse files are commonly used for disk images, database snapshots, log files and in scientific applications.

  1. ^ Giampaolo, Dominic (1999). Practical File System Design with the Be File System (PDF). Morgan Kaufmann Publishers. ISBN 9781558604971.
  2. ^ "Apple File System Guide". Apple's Developer Site. Apple Inc. Retrieved 27 April 2017.

© MMXXIII Rich X Search. We shall prevail. All rights reserved. Rich X Search