1 .\" Copyright (c) 2007 Silicon Graphics, Inc. All Rights Reserved
2 .\" Written by Dave Chinner <dgc@sgi.com>
3 .\" May be distributed as per GNU General Public License version 2.
5 .TH FALLOCATE 2 2010-09-10 "Linux" "Linux Programmer's Manual"
7 fallocate \- manipulate file space
10 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
13 .BI "int fallocate(int " fd ", int " mode ", off_t " offset \
17 This is a nonportable, Linux-specific system call.
18 For the portable, POSIX.1-specified method of ensuring that space
19 is allocated for a file, see
20 .BR posix_fallocate ().
23 allows the caller to directly manipulate the allocated disk space
24 for the file referred to by
26 for the byte range starting at
34 argument determines the operation to be performed on the given range.
35 Currently only one flag is supported for
38 .B FALLOC_FL_KEEP_SIZE
39 This flag allocates and initializes to zero the disk space
40 within the range specified by
44 After a successful call, subsequent writes into this range
45 are guaranteed not to fail because of lack of disk space.
46 Preallocating zeroed blocks beyond the end of the file
47 is useful for optimizing append workloads.
48 Preallocating blocks does not change
49 the file size (as reported by
51 even if it is less than
54 .\" Note from Amit Arora:
55 .\" There were few more flags which were discussed, but none of
56 .\" them have been finalized upon. Here are these flags:
57 .\" FA_FL_DEALLOC, FA_FL_DEL_DATA, FA_FL_ERR_FREE, FA_FL_NO_MTIME,
59 .\" All of the above flags were debated upon and we can not say
60 .\" if any/which one of these flags will make it to the later kernels.
63 .B FALLOC_FL_KEEP_SIZE
64 flag is not specified in
66 the default behavior is almost same as when this flag is specified.
67 The only difference is that on success,
68 the file size will be changed if
70 is greater than the file size.
71 This default behavior closely resembles the behavior of the
72 .BR posix_fallocate (3)
74 and is intended as a method of optimally implementing that function.
76 Because allocation is done in block size chunks,
78 may allocate a larger range than that which was specified.
81 returns zero on success, and -1 on failure.
86 is not a valid file descriptor, or is not opened for writing.
90 exceeds the maximum file size.
93 A signal was caught during execution.
99 was less than or equal to 0.
102 An I/O error occurred while reading from or writing to a file system.
106 does not refer to a regular file or a directory.
109 is a pipe or FIFO, a different error results.)
112 There is not enough space left on the device containing the file
117 The file system containing the file referred to by
119 does not support this operation.
124 is not supported by the file system containing the file referred to by
128 is available on Linux since kernel 2.6.23.
129 Support is provided by glibc since version 2.10.
135 .BR posix_fadvise (3),
136 .BR posix_fallocate (3)