Platform SDK: Files and I/O

Sparse Files

A file (typically very large) in which a lot of data is all zeros is said to contain a sparse data set. An example is a matrix in which some or much of the data is zeros. Applications that use sparse data sets include image processors and high-speed databases. In versions of NTFS prior to version 5.0, the portions of the file that did not contain useful data occupied valuable disk space.

The file compression introduced in NTFS 3.51 is a partial solution to the problem. The portions of the file that do not contain useful data are set to zero, and file compression compacts the non-data portions. However, file compression has its own drawbacks. Access time may increase due to data compression and decompression.

Windows 2000 NTFS introduces another solution, called a sparse file. When the sparse file facilities are used, the system does not allocate hard drive space to a file except in regions where it contains something other than zeros. The default data value of a sparse file is zero.