299 lines
6.7 KiB
HTML
299 lines
6.7 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of FALLOCATE</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>FALLOCATE</H1>
|
|
Section: User Commands (1)<BR>Updated: April 2014<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
fallocate - preallocate or deallocate space to a file
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>fallocate</B>
|
|
|
|
[<B>-c</B>|<B>-p</B>|<B>-z</B>]
|
|
|
|
[<B>-o</B>
|
|
|
|
<I>offset</I>]
|
|
|
|
<B>-l</B>
|
|
|
|
<I>length</I>
|
|
|
|
[<B>-n</B>]
|
|
|
|
<I>filename</I>
|
|
|
|
<P>
|
|
|
|
<B>fallocate -d</B>
|
|
|
|
[<B>-o</B>
|
|
|
|
<I>offset</I>]
|
|
|
|
[<B>-l</B>
|
|
|
|
<I>length</I>]
|
|
|
|
<I>filename</I>
|
|
|
|
<P>
|
|
|
|
<B>fallocate -x</B>
|
|
|
|
[<B>-o</B>
|
|
|
|
<I>offset</I>]
|
|
|
|
<B>-l</B>
|
|
|
|
<I>length</I>
|
|
|
|
<I>filename</I>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>fallocate</B>
|
|
|
|
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 zeroes.
|
|
<P>
|
|
|
|
The exit code returned by
|
|
<B>fallocate</B>
|
|
|
|
is 0 on success and 1 on failure.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
The
|
|
<I>length</I>
|
|
|
|
and
|
|
<I>offset</I>
|
|
|
|
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.
|
|
<P>
|
|
|
|
The options
|
|
<B>--collapse-range</B>, <B>--dig-holes</B>, <B>--punch-hole</B>,
|
|
|
|
and
|
|
<B>--zero-range</B>
|
|
|
|
are mutually exclusive.
|
|
<DL COMPACT>
|
|
<DT id="1"><B>-c</B>, <B>--collapse-range</B>
|
|
|
|
<DD>
|
|
Removes a byte range from a file, without leaving a hole.
|
|
The byte range to be collapsed starts at
|
|
<I>offset</I>
|
|
|
|
and continues for
|
|
<I>length</I>
|
|
|
|
bytes.
|
|
At the completion of the operation,
|
|
the contents of the file starting at the location
|
|
<I>offset</I>+<I>length</I>
|
|
|
|
will be appended at the location
|
|
<I>offset</I>,
|
|
|
|
and the file will be
|
|
<I>length</I>
|
|
|
|
bytes smaller.
|
|
The option
|
|
<B>--keep-size</B>
|
|
|
|
may not be specified for the collapse-range operation.
|
|
<P>
|
|
Available since Linux 3.15 for ext4 (only for extent-based files) and XFS.
|
|
<P>
|
|
A filesystem may place limitations on the granularity of the operation, in
|
|
order to ensure efficient implementation. Typically, offset and len must be a
|
|
multiple of the filesystem logical block size, which varies according to the
|
|
filesystem type and configuration. If a filesystem has such a requirement,
|
|
the operation will fail with the error EINVAL if this requirement is violated.
|
|
<DT id="2"><B>-d</B>, <B>--dig-holes</B>
|
|
|
|
<DD>
|
|
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,
|
|
<B>--keep-size</B>
|
|
|
|
is implied. If no range is specified by
|
|
<B>--offset</B>
|
|
|
|
and
|
|
<B>--length</B>,
|
|
|
|
then the entire file is analyzed for holes.
|
|
<P>
|
|
You can think of this option as doing a
|
|
"<B>cp --sparse</B>"
|
|
|
|
and then renaming the destination file to the original,
|
|
without the need for extra disk space.
|
|
<P>
|
|
See <B>--punch-hole</B> for a list of supported filesystems.
|
|
<DT id="3"><B>-i</B>, <B>--insert-range</B>
|
|
|
|
<DD>
|
|
Insert a hole of
|
|
<I>length</I>
|
|
|
|
bytes from
|
|
<I>offset</I>,
|
|
|
|
shifting existing data.
|
|
<DT id="4"><B>-l</B>, <B>--length </B><I>length</I>
|
|
|
|
<DD>
|
|
Specifies the length of the range, in bytes.
|
|
<DT id="5"><B>-n</B>, <B>--keep-size</B>
|
|
|
|
<DD>
|
|
Do not modify the apparent length of the file. This may effectively allocate
|
|
blocks past EOF, which can be removed with a truncate.
|
|
<DT id="6"><B>-o</B>, <B>--offset </B><I>offset</I>
|
|
|
|
<DD>
|
|
Specifies the beginning offset of the range, in bytes.
|
|
<DT id="7"><B>-p</B>, <B>--punch-hole</B>
|
|
|
|
<DD>
|
|
Deallocates space (i.e., creates a hole) in the byte range starting at
|
|
<I>offset</I>
|
|
|
|
and continuing for
|
|
<I>length</I>
|
|
|
|
bytes.
|
|
Within the specified range, partial filesystem blocks are zeroed,
|
|
and whole filesystem blocks are removed from the file.
|
|
After a successful call,
|
|
subsequent reads from this range will return zeroes.
|
|
This option may not be specified at the same time as the
|
|
<B>--zero-range</B>
|
|
|
|
option.
|
|
Also, when using this option,
|
|
<B>--keep-size</B>
|
|
|
|
is implied.
|
|
<P>
|
|
Supported for XFS (since Linux 2.6.38), ext4 (since Linux 3.0),
|
|
Btrfs (since Linux 3.7) and tmpfs (since Linux 3.5).
|
|
<DT id="8"><B>-v</B>, <B>--verbose</B>
|
|
|
|
<DD>
|
|
Enable verbose mode.
|
|
<DT id="9"><B>-x</B>, <B>--posix</B>
|
|
|
|
<DD>
|
|
Enable POSIX operation mode.
|
|
In that mode allocation operation always completes,
|
|
but it may take longer time when fast allocation is not supported by
|
|
the underlying filesystem.
|
|
<DT id="10"><B>-z</B>, <B>--zero-range</B>
|
|
|
|
<DD>
|
|
Zeroes space in the byte range starting at
|
|
<I>offset</I>
|
|
|
|
and continuing for
|
|
<I>length</I>
|
|
|
|
bytes.
|
|
Within the specified range, blocks are preallocated for the regions
|
|
that span the holes in the file.
|
|
After a successful call,
|
|
subsequent reads from this range will return zeroes.
|
|
<P>
|
|
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.
|
|
<P>
|
|
Option <B>--keep-size</B> can be specified to prevent file length
|
|
modification.
|
|
<P>
|
|
Available since Linux 3.14 for ext4 (only for extent-based files) and XFS.
|
|
<DT id="11"><B>-V</B>, <B>--version</B>
|
|
|
|
<DD>
|
|
Display version information and exit.
|
|
<DT id="12"><B>-h</B>, <B>--help</B>
|
|
|
|
<DD>
|
|
Display help text and exit.
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>AUTHORS</H2>
|
|
|
|
|
|
Eric Sandeen
|
|
|
|
<BR>
|
|
|
|
|
|
Karel Zak
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+truncate">truncate</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+fallocate">fallocate</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+posix_fallocate">posix_fallocate</A></B>(3)
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H2>AVAILABILITY</H2>
|
|
|
|
The fallocate command is part of the util-linux package and is available from
|
|
|
|
Linux Kernel Archive
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="13"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="14"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="15"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="16"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="17"><A HREF="#lbAF">AUTHORS</A><DD>
|
|
<DT id="18"><A HREF="#lbAG">SEE ALSO</A><DD>
|
|
<DT id="19"><A HREF="#lbAH">AVAILABILITY</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:12 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|