Symantec logo

Reservation: preallocating space to a file

Space reservation is used to make sure that applications do not fail because the file system is out of space. An application can preallocate space for all the files it needs before starting to do any job. By allocating space in advance, the file is optimally allocated for performance, and file accesses are not slowed down by the need to allocate storage. This allocation of resources can be important in applications that require a guaranteed response time. With very large files, use of space reservation can avoid the need to use indirect extents. It can also improve performance and reduce fragmentation by guaranteeing that the file consists of large contiguous extents.

VxFS provides an API to preallocate space to a file at the time of the request rather than when data is written into the file. Preallocation, or reservation, prevents any unexpected out-of-space condition on the file system by ensuring that a file's required space is associated with the file before data is written to the file. Storage can be reserved for a file at any time, and reserved space to a file is not allocated to other files in the file system. The API provides the application the option to change the size of the file to include the reserved space.

Reservation does not perform zeroing of the allocated blocks to the file. Therefore, this facility is limited to applications running with appropriate privileges, unless the size of the file is not changed with the reservation request. The data that appears in the newly allocated blocks for the file may have been previously contained in another file.

Reservation is a persistent attribute for the file saved on disk. When this attribute is set on a file, the attribute is not released when the file is truncated. The reservation must be cleared through the same API, or the file must be removed to free the reserved space. At the time of specifying the reservation, if the file size is less than the reservation amount, space is allocated to the file from the current file size up to the reservation amount. When the file is truncated, space below the reserved amount is not freed.