Wednesday, December 15, 2010

Sparse File concept in Linux

A sparse file is a type of file that attempts to use file system space more efficiently when blocks allocated to the file are mostly empty. This is achieved by writing brief information (metadata) representing the empty blocks to disk instead of the actual "empty" space which makes up the block, using less disk space. The full block size is written to disk as the actual size only when the block contains "real" (non-empty) data.
When reading sparse files, the file system transparently converts metadata representing empty blocks into "real" blocks filled with zero bytes at runtime. The application is unaware of this conversion.

To create sparse-file in linux using dd command
dd if=/dev/zero of=sparse-file bs=1k count=0 seek=5120

No comments:

Post a Comment