[Next] [Previous] [Top] [Contents] [Index]
VxFS System Administrator's Guide
This chapter describes the extent attributes of files on VERITAS File Systems. VxFS allocates disk space to files in groups of one or more adjacent blocks called extents. In addition, the VxFS file system defines an application interface (described in Chapter 6, "Application Interface") that allows programs to control some aspects of the extent allocation for a given file. Application control of extent allocation policy is handled through the ioctl interface. The extent allocation policies associated with a file are referred to as the extent attributes of the file.
With the VxFS
setext commands, users can view or manipulate file extent attributes. In addition, the
cpio commands preserve extent attributes when a file is moved, copied, backed up, or archived.
The following topics are covered in this chapter:
The two basic extent attributes associated with a file are its reservation and its fixed extent size. By manipulating a file's reservation, space can be preallocated to the file. By setting a fixed extent size, a user can override the default allocation policy of the file system.
In addition to these two basic extent attributes, there are policies that determine how those attributes are expressed when an allocation is done. A user can specify that:
Some of the extent attributes are persistent and become part of the on-disk information about the file, while other attributes are temporary and are not maintained when the file is closed or the system is rebooted. The persistent attributes are similar to the file's permissions and are actually written in the inode for the file. When a file is copied, moved, or archived, only the persistent attributes of the source file can be maintained in the new file (see the section "Other Controls" for more information).
- the space reserved for a file must be contiguous
- no allocations should be made for a file beyond the current reservation
- unused reservation should be released when the file is closed
- space should be allocated but no reservation should be assigned
- the file size should be changed to immediately incorporate the allocated space
In general, the user will only set extent attributes for reservation.
Many of the attributes associated with a file are designed to be used
by applications that are tuned to a particular pattern of I/O or
disk-aligned file systems
manual page and Chapter
6, "Application Interface," for further information).
Reservation: Preallocating Space to a File
With the VxFS file system, it is possible to preallocate space for a file. This space is associated with the file so that it cannot be allocated to other files in the file system. With preallocation, space is assigned to a file at the time of the request rather than when data is written into the file. Using preallocation, users can be certain that a file's required space will be associated with the file before it is needed, thus preventing an unexpected out-of-space condition on the file system.
Persistent reservation is not released when a file is truncated. To free reserved space, the reservation must be cleared or the file must be removed.
Fixed Extent Size
The default allocation policy of the VxFS file system uses a variety of heuristics to determine how to make an allocation to a file when a write requires more space. The policy attempts to balance the two goals of making allocations very large so that I/O performance is optimized, and minimizing file system fragmentation by making the allocation from space available in the file system where the data would best fit.
By erring on the side of aggressive allocation sizes, an individual file would tend to be more contiguous and have better I/O characteristics, but the overall performance of the file system would degrade. This is because the unused space in each file is eventually returned to the file system, fragmenting free space by breaking large extents into smaller pieces. By erring on the side of minimizing fragmentation for the file system, files may become so non-contiguous that their I/O characteristics would degrade.
A fixed extent size overrides the default allocation policies for a file. and is always a persistent attribute. Be careful to choose the an extent size appropriate to the application when using fixed extents. One of the advantages of the VxFS file system's extent- based allocation policies is that allocations use indirect blocks much more rarely than block based file systems, thus eliminating many of the disk accesses that are made necessary by indirect references. A small extent size can, however, eliminate this advantage.
Fixed extent sizes are particularly appropriate in the following situations:
Custom applications may also use fixed extent sizes for specific reasons, such as to align extents to cylinder or striping boundaries on disk).
- If a file is large and sparse and its write size is fixed, a fixed extent size that is a multiple of the write size can minimize space wasted by blocks that do not contain user data due to misalignment of write and extent sizes. (The default extent size for a sparse file is 8K.)
- If a file is large and contiguous, a large fixed extent size can minimize the number of extents in the file.
The auxiliary controls on extent attributes determine:
- alignment of allocations
- contiguity of allocations
- whether the file can be written beyond its reservation
- whether unused reservation is released when the file is closed
- whether the reservation is a persistent attribute of the file
- when the space reserved for a file is to become part of the file
By specifying an alignment restriction on allocations, a file's
allocations can be coordinated with a particular I/O pattern or disk
manual page and the
introduction to Chapter 6, "Application
Interface," for further details). alignment can only be specified
if a fixed extent size has also been set. Setting alignment
restrictions on a file's allocations is best left to well designed
When a reservation is made, a specification can be included in the request that the allocation of the reservation be contiguous (all one extent). Maximum contiguity of a file optimizes its I/O characteristics.
Note: When using fixed extent sizes or alignment, the file system will return an error message reporting insufficient space if there is no suitably sized (or aligned) extent. This may happen even if there is a lot of free space on the file system and the fixed extent size is large.
Writes Beyond Reservation
When a reservation is made, a specification can be included in the request that no allocations are to be made to the file beyond the reservation request. Once a write fills up the last available block in the reservation, no more space is allocated. This can be used like
ulimit to prevent a file's uncontrolled growth.
When a reservation is made, a specification can be included in the request that any unused reservation be released when the file is closed. If this is set, the reservation will be trimmed to the file size when the file is closed, and any extra space will be released. If multiple processes have the file open, it is not considered closed until the final close of the file.
When a reservation is made, a specification can be included in the request that the reservation not be a persistent attribute of the file. Unused reservation is therefore discarded when the file is closed.
Including Reservation in the File
When a reservation is made, a specification can be included in the request that the size of the file be adjusted to include the reservation. Normally, the space of the reservation is not included in the file until such time as an extending write operation requires it. Very large temporary files can quickly be created by using a reservation that immediately changes the file size. Unlike an
ftrunc operation, which can also increase the size of a file, this type of reservation does no zeroing of the blocks included in the file. For this reason, use of this facility is limited to users with appropriate privileges, as the data that appears in the file may be data that was formerly contained in another file.
Commands Related to Extent Attributes
The VxFS commands for manipulating extent attributes are
getext. With these commands, a
user can set up files with a given set of extent attributes or view any
attributes that are already associated with a file. See the
manual pages for
details on how to use these commands.
The VxFS commands
and the standard
UNIX system commands
cpio, understand extent attributes. These commands
preserve extent attributes when moving, copying, backing up, or
Most of these commands include a command line option (
-e) for maintaining extent attributes on files that they manipulate. This option specifies how to handle a VxFS file that has extent attribute information. Extent attributes include reserved space, a fixed extent size, and extent alignment. It may not be possible to preserve the extent attribute information if the destination file system does not support extent attributes, has a different block size than the source file system, or lacks free extents appropriate to satisfy the extent attribute requirements.
-e option takes any of the following keywords as an argument:
The commands that move, copy, or archive files (
- Issue a warning message if extent attribute information cannot be kept (the default).
- Fail the copy if extent attribute information cannot be kept.
- Ignore extent attribute information entirely.
cpio) use the
-e option with arguments of
For example, the
mv command could be used with the
-e option to produce the following results:
- Using the
ignore keyword, any extent attributes for files to be moved will not be preserved.
- Using the
warn keyword, the command issues a warning if extent attributes for a file to be moved cannot be preserved; for example, if the file system into which the file is to be moved is not a VxFS type. In this case, the file will be moved, but the extent attributes are not preserved.
- Using the
force keyword, if attributes cannot be preserved, an error is issued and the file is not moved.
- In addition, the ls command has an -e option, which is used to print the extent attributes of the file.
Failure to Preserve Extent Attributes
Whenever a file is copied, moved, or archived using commands that preserve extent attributes, there is the possibility that the extent attributes for files cannot be preserved. There are three major reasons that such a failure might occur:
- The file system onto which a file is to be copied, moved, or restored from an archive is not a VxFS type. Since other file system types do not support the extent attributes of the VxFS file system, the attributes of the source file are lost when migrating to another file system type.
- The file system onto which the file is to be copied, moved, or restored is a VxFS type, but it does not have enough free space of the right type to satisfy the extent attributes. For example, consider a 50K file and a reservation of 1 MB. If the target file system has 500K free, it could easily hold the file, but it cannot satisfy the reservation.
- The file system onto which a file is to be copied, moved, or restored from an archive is a VxFS type, but the different block sizes of the source and target file systems make extent attributes of the file impossible to maintain. For example, consider a source file system of block size 1024, a target file system of block size 4096, and a file to be operated on that has a fixed extent size of 3 blocks (3072 bytes). Although a fixed extent size of 3 can be used on the source file system, it does not translate onto the target file system.
- If the same source and target file systems in the preceding example are presumed, and if the file to be operated on is of fixed extent size 4, the attribute could be preserved. This is because a 4 block (4096 byte) extent on the source file system would translate into a 1 block extent on the target.
- On a system with mixed block sizes, a copy, move, or restoration operation may or may not succeed in preserving attributes. It is recommended that the same block size be used for all file systems on a given system.
VxFS System Administrator's Guide
[Next] [Previous] [Top] [Contents] [Index]