DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
[Next] [Previous] [Top] [Contents] [Index]

VxFS System Administrator's Guide

Extent Attributes

Chapter 3


Introduction

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 getext and setext commands, users can view or manipulate file extent attributes. In addition, the vxdump, vxrestore, mv, cp, and cpio commands preserve extent attributes when a file is moved, copied, backed up, or archived.

The following topics are covered in this chapter:

Attribute Specifics

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).

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 (see the mkfs_vxfs(1M) 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).

Other Controls

The auxiliary controls on extent attributes determine:

Alignment

By specifying an alignment restriction on allocations, a file's allocations can be coordinated with a particular I/O pattern or disk alignment (see the mkfs_vxfs(1M) 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 applications.

Contiguity

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.

Reservation Trimming

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.

Reservation Persistence

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 setext and 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 getext(1) and setext(1) manual pages for details on how to use these commands.

The VxFS commands vxdump(1M) and vxrestore(1M) and the standard UNIX system commands mv, cp, and cpio, understand extent attributes. These commands preserve extent attributes when moving, copying, backing up, or restoring files.

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.

The -e option takes any of the following keywords as an argument:

warn
Issue a warning message if extent attribute information cannot be kept (the default).

force
Fail the copy if extent attribute information cannot be kept.

ignore
Ignore extent attribute information entirely.

The commands that move, copy, or archive files (mv, cp and cpio) use the -e option with arguments of ignore, warn, or force.

For example, the mv command could be used with the -e option to produce the following results:

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:

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]