1FALLOCATE(1)                     User Commands                    FALLOCATE(1)
2
3
4

NAME

6       fallocate - preallocate or deallocate space to a file
7

SYNOPSIS

9       fallocate [-c|-p|-z] [-o offset] -l length [-n] filename
10
11       fallocate -d [-o offset] [-l length] filename
12
13       fallocate -x [-o offset] -l length filename
14

DESCRIPTION

16       fallocate  is  used  to manipulate the allocated disk space for a file,
17       either to deallocate or preallocate it.  For filesystems which  support
18       the  fallocate system call, preallocation is done quickly by allocating
19       blocks and marking them as uninitialized, requiring no IO to  the  data
20       blocks.   This  is  much faster than creating a file by filling it with
21       zeroes.
22
23       The exit code returned by fallocate is 0 on success and 1 on failure.
24

OPTIONS

26       The length and offset arguments may be followed by  the  multiplicative
27       suffixes  KiB  (=1024),  MiB (=1024*1024), and so on for GiB, TiB, PiB,
28       EiB, ZiB, and YiB (the "iB" is optional, e.g., "K" has the same meaning
29       as  "KiB")  or  the suffixes KB (=1000), MB (=1000*1000), and so on for
30       GB, TB, PB, EB, ZB, and YB.
31
32       The   options   --collapse-range,   --dig-holes,   --punch-hole,    and
33       --zero-range are mutually exclusive.
34
35       -c, --collapse-range
36              Removes  a  byte range from a file, without leaving a hole.  The
37              byte range to be collapsed starts at offset  and  continues  for
38              length  bytes.  At the completion of the operation, the contents
39              of the file starting  at  the  location  offset+length  will  be
40              appended  at  the  location  offset, and the file will be length
41              bytes smaller.  The option --keep-size may not be specified  for
42              the collapse-range operation.
43
44              Available  since  Linux  3.15  for  ext4  (only for extent-based
45              files) and XFS.
46
47       -d, --dig-holes
48              Detect and dig holes.  This  makes  the  file  sparse  in-place,
49              without  using  extra  disk space.  The minimum size of the hole
50              depends on filesystem  I/O  block  size  (usually  4096  bytes).
51              Also,  when  using  this  option, --keep-size is implied.  If no
52              range is specified by --offset and  --length,  then  the  entire
53              file is analyzed for holes.
54
55              You  can  think of this option as doing a "cp --sparse" and then
56              renaming the destination file to the original, without the  need
57              for extra disk space.
58
59              See --punch-hole for a list of supported filesystems.
60
61       -i, --insert-range
62              Insert  a  hole  of  length bytes from offset, shifting existing
63              data.
64
65       -l, --length length
66              Specifies the length of the range, in bytes.
67
68       -n, --keep-size
69              Do not modify the apparent length of the file.  This may  effec‐
70              tively  allocate  blocks  past  EOF, which can be removed with a
71              truncate.
72
73       -o, --offset offset
74              Specifies the beginning offset of the range, in bytes.
75
76       -p, --punch-hole
77              Deallocates space (i.e., creates  a  hole)  in  the  byte  range
78              starting  at offset and continuing for length bytes.  Within the
79              specified range, partial filesystem blocks are zeroed, and whole
80              filesystem blocks are removed from the file.  After a successful
81              call, subsequent reads from this range will return zeroes.  This
82              option may not be specified at the same time as the --zero-range
83              option.  Also, when using this option, --keep-size is implied.
84
85              Supported for XFS (since Linux 2.6.38), ext4 (since Linux  3.0),
86              Btrfs (since Linux 3.7) and tmpfs (since Linux 3.5).
87
88       -v, --verbose
89              Enable verbose mode.
90
91       -x, --posix
92              Enable  POSIX operation mode.  In that mode allocation operation
93              always completes, but it may take longer time when fast  alloca‐
94              tion is not supported by the underlying filesystem.
95
96       -z, --zero-range
97              Zeroes space in the byte range starting at offset and continuing
98              for length bytes.  Within the specified range, blocks are preal‐
99              located  for the regions that span the holes in the file.  After
100              a successful call, subsequent reads from this range will  return
101              zeroes.
102
103              Zeroing  is  done within the filesystem preferably by converting
104              the range into unwritten extents.  This approach means that  the
105              specified  range will not be physically zeroed out on the device
106              (except for partial blocks at the either end of the range),  and
107              I/O is (otherwise) required only to update metadata.
108
109              Option --keep-size can be specified to prevent file length modi‐
110              fication.
111
112              Available since Linux  3.14  for  ext4  (only  for  extent-based
113              files) and XFS.
114
115       -V, --version
116              Display version information and exit.
117
118       -h, --help
119              Display help text and exit.
120

AUTHORS

122       Eric Sandeen ⟨sandeen@redhat.com⟩
123       Karel Zak ⟨kzak@redhat.com⟩
124

SEE ALSO

126       truncate(1), fallocate(2), posix_fallocate(3)
127

AVAILABILITY

129       The  fallocate  command is part of the util-linux package and is avail‐
130       able from Linux Kernel Archive  ⟨https://www.kernel.org/pub/linux/utils
131       /util-linux/⟩.
132
133
134
135util-linux                        April 2014                      FALLOCATE(1)
Impressum