$linuxjunkies
>

preallocation

also: space preallocation, disk preallocation

Preallocation is reserving disk space for a file before it is written to, ensuring the space exists contiguously and preventing out-of-disk errors during writes.

Preallocation reserves a fixed amount of disk space for a file upfront, rather than allocating space dynamically as data is written. This is useful for large files or real-time applications where disk fragmentation or running out of space mid-operation would be problematic.

Common use cases include database files, virtual machine images, and video editing projects. The preallocated space may be filled with zeros or remain uninitialized depending on the method and filesystem.

In Linux, preallocation can be done with tools like fallocate or dd. For example, fallocate -l 1G largefile.bin instantly reserves 1GB of contiguous space without actually writing data to every block.

Filesystems like ext4, XFS, and Btrfs support efficient preallocation. The advantage is predictable performance and guaranteed space availability; the tradeoff is wasted disk space if the file never grows to fill the allocation.

Related terms