A file system stores data on the storage device by managing the allocation of each file's blocks (or chunks of the file's content) within the file system.
This is done by maintaining the location of each block for each file in a table that itself resides on the disk. Early DOS and Windows readers might remember the dreaded FAT. Each file system uses a different method for allocation and retrieval of file blocks.
There are two common types of file-system space allocation strategies: block allocation and extent allocation. Block-based allocation creates incremental disk space for a file each time it is extended, whereas extent-based allocation creates a large series of contiguous blocks each time the file exhausts the space available in its last extent.
The block-based allocation mechanism used by traditional Unix files provides a flexible and efficient block-allocation policy. Disk blocks are allocated on the go, which means a minimal number of file-system blocks are allocated to a file in an attempt to conserve storage space. When a file is extended, blocks are allocated from a free block map, so that blocks are sometimes allocated in a random order. This can cause excessive disk seeking, and later reads from the file system will result in the disk mechanism seeking to all of the random block locations that were allocated during the extension of the file.
Random block allocation can be avoided by optimizing the block-allocation policy so that it attempts to allocate a sequential series of blocks. By using a smarter block allocation, large sequential allocations can be achieved. This results in greatly reduced disk seeking. Continuous file-system block allocation will, however, eventually end up with file blocks fragmented across the file system, and file-system access will eventually revert back to a random nature.
The block allocation scheme must also write information about where each new block is allocated every time the file is extended. If the file is being extended one block at a time, a lot of extra disk I/O will be required to write the file-system block structure information. File-system block structure information is known as metadata. File-system metadata is always written synchronously to the storage device, which means operations that change the size of a file need to wait for each metadata operation to complete. As a result, metadata operations can significantly slow overall file-system performance.