fallocate
also: fallocate(2), posix_fallocate
A command and system call that pre-allocates disk space for a file without writing data to it, ensuring contiguous space and improving performance.
fallocate reserves disk blocks for a file in advance, which is useful when you need a file of a specific size but don't want to write actual data yet. This is faster than writing zeros and reduces filesystem fragmentation by ensuring the space is contiguous.
Common use cases include preparing space for sparse files, creating swap files, and allocating space for databases or virtual machine disk images. For example: fallocate -l 1G diskimage.img instantly creates a 1 GB file with space reserved, without the delay of writing gigabytes of zeros.
The command supports different allocation modes: -l for length, -n to avoid writing actual data (supported filesystems), and various punch-hole operations to free space within allocated regions.