fallocate [-c] [-n] [-p] [-z] [-o offset] -l length filename
fallocate -d [-o offset] [-l length] filename
fallocate is used to manipulate the allocated disk space for a file,
either to deallocate or preallocate it. For filesystems which support
the fallocate system call, preallocation is done quickly by allocating
blocks and marking them as uninitialized, requiring no IO to the data
blocks. This is much faster than creating a file by filling it with
The exit code returned by fallocate is 0 on success and 1 on failure.
The length and offset arguments may be followed by the multiplicative
suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB,
EiB, ZiB and YiB (the "iB" is optional, e.g., "K" has the same meaning
as "KiB") or the suffixes KB (=1000), MB (=1000*1000), and so on for
GB, TB, PB, EB, ZB and YB.
The options --collapse-range, --dig-holes, --punch-hole and
--zero-range are mutually exclusive.
Removes a byte range from a file, without leaving a hole. The
byte range to be collapsed starts at offset and continues for
length bytes. At the completion of the operation, the contents
of the file starting at the location offset+length will be
appended at the location offset, and the file will be length
bytes smaller. The option --keep-size may not be specified for
colapse range operation.
Available since Linux 3.15 for ext4 (only for extent-based
files) and XFS.
Detect and dig holes. This makes the file sparse in-place,
without using extra disk space. The minimum size of the hole
depends on filesystem I/O block size (usually 4096 bytes).
Also, when using this option, --keep-size is implied. If no
range is specified by --offset and --length, then the entire
file is analyzed for holes.
You can think of this option as doing a "cp --sparse" and then
renaming the destination file to the original, without the need
for extra disk space.
See --punch-hole for a list of supported filesystems.
-l, --length length
Specifies the length of the range, in bytes.
call, subsequent reads from this range will return zeroes. This
option may not be specified at the same time as the
--zero-range option. Also, when using this option, --keep-size
Supported for XFS (since Linux 2.6.38), ext4 (since Linux 3.0),
Btrfs (since Linux 3.7) and tmpfs (since Linux 3.5).
Enable verbose mode.
Zeroes space in the byte range starting at offset and continuing
for length bytes. Within the specified range, blocks are preal-
located for the regions that span the holes in the file. After
a successful call, subsequent reads from this range will return
Zeroing is done within the filesystem preferably by converting
the range into unwritten extents. This approach means that the
specified range will not be physically zeroed out on the device
(except for partial blocks at the either end of the range), and
I/O is (otherwise) required only to update metadata.
Option --keep-size can be specified to prevent file length modi-
Available since Linux 3.14 for ext4 (only for extent-based
files) and XFS.
Display version information and exit.
Display help text and exit.
Eric Sandeen <firstname.lastname@example.org>
Karel Zak <email@example.com>
fallocate(2), posix_fallocate(3), truncate(1)
The fallocate command is part of the util-linux package and is avail-
able from Linux Kernel Archive <ftp://ftp.kernel.org/pub/linux/utils
util-linux September 2011 FALLOCATE(1)
Man Pages Copyright Respective Owners. Site Copyright (C) 1994 - 2020
All Rights Reserved.