*** Welcome to piglix ***

Block suballocation


Block suballocation is a feature of some computer file systems which allows large blocks or allocation units to be used while making efficient use of "slack" space at the end of large files, space which would otherwise be lost for other use to internal fragmentation.

In file systems that don't support fragments, this feature is also called tail merging or tail packing because it is commonly done by packing the "tail", or last partial block, of multiple files into a single block.

File systems have traditionally divided the disk into equally sized blocks to simplify their design and limit the worst-case fragmentation. Block sizes are typically multiples of 512 due to the size of hard disk sectors. When files are allocated by some traditional file systems, only whole blocks can be allocated to individual files. But as file sizes are often not multiples of the file system block size, this design inherently results in the last blocks of files (called tails) occupying only a part of the block, resulting in what is called internal fragmentation (not to be confused with external fragmentation). This waste of space can be significant if the file system stores many small files and can become critical when attempting to use higher block sizes to improve performance. FFS and other derived UNIX file systems support fragments which greatly mitigate this effect.

Block suballocation addresses this problem by dividing up a tail block in some way to allow it to store fragments from other files.

Some block suballocation schemes can perform allocation at the byte level; most, however, simply divide up the block into smaller ones (the divisor usually being some power of 2). For example, if a 38 KiB file is to be stored in a file system using 32 KiB blocks, the file would normally span two blocks, or 64 KiB, for storage; the remaining 26 KiB of the second block becomes unused slack space. With an 8 KiB block suballocation, however, the file would occupy just 6 KiB of the second block, leave 2 KiB (of the 8 KIB suballocation block) slack and free the other 24 KiB of the block for other files.


...
Wikipedia

...