test veritas logo


fsadm_vxfs(1M)

NAME

fsadm_vxfs - resize or reorganize (defragment) a VxFS file system

SYNOPSIS

fsadm [-t vxfs] [-D] [-d] [-E] [-e] [-H] [-s] [-v]
      [-k ckpt_name][-l largesize][-p passes]
      [-r rawdev][-T time] mount_point

fsadm [-t vxfs] [-b newsize] [-r rawdev] mount_point

fsadm [-t vxfs] [-o specific_options] mount_point | special

fsadm [-t vxfs] [-d] [-D] [-e] [-E] [-H] -f filename | -

fsadm [-t vxfs] [-L] mount_point

fsadm [-t vxfs] -R [-o {aggressive|analyse|analyze|auto|ssd|thin} |

      -A] [-P] mount_point

fsadm [-t vxfs] [-H] [-S {shared|compressed|all}] mount_point

fsadm [-t vxfs] -C [-v] path_of_mount_point

fsadm [-t vxfs] -e [-i] path_of_mount_point

AVAILABILITY

VRTSvxfs

DESCRIPTION

The fsadm command performs online administration functions on VxFS file systems, Storage Checkpoints, or individual files and directories. The fsadm command supports file system resizing, extent reorganization, directory reorganization, querying or changing the largefiles flag, Thin Storage Reclamation, and free space defragmentation. The fsadm command operates on file systems mounted for read/write access; however, the -o option can also operate on a special device containing a clean, unmounted file system. Only a privileged user can change the largefiles flag on a mounted file system, or resize or reorganize a file system. You can invoke only one instance of fsadm per file system at a time.

If mount_point is a Storage Checkpoint, fsadm performs the specified operation on the entire file system, including all of the file system’s Storage Checkpoints.

Cluster File System Issues

See the -L and the -o logsize=size options for CFS-related issues.

NOTES

When you have fileset (Storage Checkpoint) quotas enabled on a file system with fsckptadm_vxfs(1M) and you reorganize the file system or run free space defragmentation with fsadm, fsadm changes the file system and affects the Storage Checkpoint quota usage on the file system. For example:

# fsckptadm getquotalimit $DIR1
Filesystem hardlimit softlimit usage action_flag
/mnt1 200000 100000 103952
# fsadm -ed $DIR1 # fsckptadm getquotalimit $DIR1
Filesystem hardlimit softlimit usage action_flag
/mnt1 200000 100000 118106

Thin Storage Reclamation is a slow process and may take over an hour to complete.

If a file system has files that are both shared and compressed, then the savings reported by the -S all option are approximate; the actual savings will be higher. Such files can be produced by compressing with the vxcompress command, and then making a snapshot with the vxfilesnap command.

OPTIONS

If no options are specified, fsadm prints the current largefiles flag setting, then exits. The -b, -L, -o largefiles, and -o nolargefiles options cannot be specified if any other options are given. If both -e and -d are specified, fsadm first completes the directory reorganization, then does the extent reorganization.
-A Initiates Thin Storage aggressive reclamation on the mount point specified by mount_point. The operation compacts the existing allocated blocks in the file system to create larger regions of free blocks, potentially reclaiming more than the default reclamation mode, which does not move any blocks that are in use. As part of this operation, extra space allocation might be triggered from the underlying Thin Storage, which is released at the end of the operation. Aggressive reclamation can take quite a long time, and can also fragment existing large allocations.
The return values are the same as for the vxfs_ts_reclaim() API. See the vxfs_ts_reclaim(3) manual page.
-b newsize Resizes the file system to newsize. The default units is sectors, but you can specify kilobytes, megabytes, or gigabytes by appending the value with k, K, m, M, g, or G. -b cannot be used with the -cdDeEfko options.
-d Reorganizes directories. Directory entries are reordered to place subdirectory entries first, then all other entries in decreasing order of time of last access. The directory is also compacted to remove free space.
For disk layout Version 8 and later, the -d option removes empty hidden directories in partitioned directories. If the pdir_enable tunable is set to 0, then the -d option converts partitioned directories to regular directories.
-D Reports on directory fragmentation. If specified with the -d option, the fragmentation report is produced both before and after the directory reorganization.
-C Free space defragmentation. Minimizes file system free space fragmentation. This attempts to get bigger chunks of free space on the device.
-e Extent reorganization. Minimizes file system fragmentation. Files are reorganized to have the minimum number of extents. Before performing file reorganization, the fsadm command also tries to perform free space defragmentation so that file reorganization is done efficiently.
-E Reports on extent fragmentation. If specified with the -e option, the fragmentation report is produced both before and after the extent reorganization.
-f filename | -
  Performs and reports extent reorganization or directory reorganization on an individual file or directory. For example, when used with the -d option, a reorganization is performed on the specified directory. When used with the -e option, an extent reorganization is performed on a specified file. If you specify - (dash), the command reads input from the standard input device instead of using a file name or directory name.
-H When specified with the -D, -E, or -S option, displays the output in the following human-friendly units: B (bytes), KB (kilobytes), MB (megabytes), GB (gigabytes), TB (terabytes), PB (petabytes), and EB (exabytes).
-i Skip files on which I/O operations have been performed in last 60 seconds during extent reorganization operation. -i option can only be used with -e option.
-k ckpt_name Reorganizes or reports directories or extent fragmentation on the specified Storage Checkpoint. See also NOTES section on Storage Checkpoint quotas.
-l largesize Large extent size in file system blocks. Indicates the size of extents to be considered as large extents, that is, extents that are immovable while performing an extent defragmentation. The value must be between 8 and 2048 blocks. The default is 64 blocks.
-L Queries the current size of the intent log as well as the volume on which the log resides. On file systems with disk layout Version 8 or later, the -L option also reports the current size of the Reference Count Queue (RCQ). On single-volume file systems, logvol will be empty. For cluster file systems, this command displays the information for the local node only, which is the node on which the command is being executed.
The -L option is mutually exclusive with all other options.
-o specific_options
  Specifies VxFS-specific options.
aggressive Initiates Thin Storage aggressive reclamation. You must specify the -R option along with this VxFS-specific option. The operation compacts the existing allocated blocks in the file system to create larger regions of free blocks potentially reclaimed than the default mode, which does not move any blocks that are in use. As part of this operation, extra space allocation might be triggered from the underlying Thin Storage, which is released at the end of the operation. Aggressive reclamation can take quite a long time, and can also fragment existing large allocations. The exit statuses from fsadm are unchanged.
Specifying the -R -A options is a synonym for this VxFS-specific option.
analyse|analyze
  Initiates the analyze reclaim option. analyse is a synonym for analyze. You must specify the -R option along with this VxFS-specific option. The operation checks the file system for free space and advises whether you should use Normal Reclaim Aggressive Reclaim. The decision has to be taken by the user. The exit statuses from fsadm are unchanged.
ssd Initiates the TRIM command on an underlying SSD volume. In the case of a volume set, the command works only for SSD volumes.
thin Initiates Thin Reclamation on a Thin Reclaimable volume. In the case of a volume set, the command works only for Thin Reclaimable volumes.
auto Initiates the auto reclaim option. You must specify the -R option along with this VxFS-specific option. The operation first checks the file system for free space and takes the appropriate decision whether to use Normal Reclaim or Aggressive Reclaim. Depending on the decision, fsadm performs Aggressive Reclaim or Normal Reclaim on behalf of the user. The exit statuses from fsadm are unchanged.
largefiles Sets the largefiles flag for the file system. When this flag is set, large files (greater than two gigabytes) can be created on the file system. The -o largefiles option is mutually exclusive with the -o nolargefiles option and with all other -o options.
logsize=size
  Allocates the intent log size in file system blocks for the specified file system. The recommended value for size is greater than 256K. The maximum is 256 MB.
size can also be specified with a suffix to indicate a unit of measure other than file system blocks. Append k or K to indicate the value is in kilobytes, or m or M to indicate megabytes. An appended letter can be separated from the number by a space. In that case, enclose the letter and number in a set of quotes (for example, "512 k").
System performance can improve by increasing the size of the intent log because it reduces the frequency at which the log wraps. Increasing the intent log size can also increase the time required for a log replay.
In a cluster file system, every node has its own intent log. This action applies only to the intent log of local node (e.g., the node on which the command is being executed).
See the logsize specific option of the mkfs_vxfs(1M) manual page for more information on log sizes.
logvol=volumename
  Directs the intent log size allocation specified by logsize to the specified intent logging volume. volumename must exist and belong to the same volume set as the file system. This modifies the file system log allocation policy to contain the specified device. The old log space is freed after the command completes.
If logvol is specified and logsize is not specified, the log is moved to the new volume while retaining the existing size.
mntlock=ID Specifies that the mount point will be locked with the specified identifier, ID, which will disallow unmounting the file system except if the umount command is invoked with the mntunlock option. The identifier can be any ASCII string of up to 31 bytes.
mntunlock=ID
  Unmounts a file system that was mounted with the mntlock=ID option. The mtab entry for the file system shows whether the file system was mounted with the mntlock option. The specified identifier, ID, must match the identifier specified with the mntlock option that was used to lock the mount point.
nolargefiles
  Clears the largefiles flag for the file system. When the largefiles flag is not set, large files cannot be created on the file system. Any attempt to clear the flag fails if a large file exists on the file system.
You can set or clear the flag on a mounted file system by specifying mount_point, or on an unmounted file system on the device special.
When invoked without arguments, fsadm prints the current state of the largefiles flag.
Be careful when implementing large file system capability. System administration utilities such as backup may not operate correctly if they are not large file aware. In addition, the -o nolargefiles option is mutually exclusive with the -o largefiles option and with all other -o options.
maxlink | nomaxlink
  If maxlink is specified, this sets the maxlink flag on the file system. When this flag is set, a directory can contain more than 32K sub-directories. The -o maxlink option is mutually exclusive with the -o nomaxlink option. The default is maxlink. You can set the flag only on mounted file systems.
If nomaxlink is specified, this clears the maxlink flag on the file system. When the maxlink flag is not set, no directory can contain more than 32K sub-directories. Any attempt to clear the flag fails if there already exists at least one directory with more than 32K sub-directories. You can clear the flag only on mounted file systems.
When fsadm is invoked without any arguments, it prints the current state of the maxlink flag.
The -o option cannot be used with the -bcdDeEfk options.
rcqsize=size
  You can specify the rcqsize option only on a VxFS file system with disk layout Version 8 or later. The rcqsize option allocates the Reference Count Queue (RCQ) size in file system blocks for the specified file system. You should set the RCQ size between 1 MB and 64 MB.
You can also specify the size parameter with a suffix to indicate a unit of measure other than file system blocks. Append k or K to indicate that the value is in kilobytes, or m or M to indicate megabytes. An appended letter can be separated from the number by a space, in which case you must enclose the letter and number in a set of double quotation marks, such as "512 k".
Performance of copy-on-write on shared extents or the creation of file level snapshots can get delayed if the RCQ is under too much load. Specifically, if the RCQ is full, then writes on shared extents on that node can get significantly delayed. This situation can be mitigated by increasing the size of the RCQ up to the maximum, as required.
In a cluster file system, every node has its own RCQ. This action applies only to the RCQ of local node, which is the node on which the command is being executed.
See the rcqsize specific option of the mkfs_vxfs(1M) manual page for more information on RCQ sizes.
-P Performs multi-threaded Thin Storage Reclamation. By default, the fsadm command performs single-threaded Thin Storage Reclamation. To use multi-threaded Thin Storage Reclamation, the array must support multiple concurrent reclaim operations.
-p passes Maximum number of passes to run. The default is five passes. Reorganizations are processed until reorganization is complete, or until the specified number of passes are run.
-r rawdev Path name of the raw device to read to determine file layout and fragmentation. This option can be used when fsadm cannot determine the raw device. There can be a performance benefit from using raw devices, since a write to a raw device bypasses the operating system’s buffer cache. Data can then be transferred directly from the application’s buffer cache to the disk.
-R Initiates Thin Reclamation for a Thin Reclaimable volume or TRIM on an SSD volume. In the case of a volume set, the commands reclaims on a thin reclaimable volume and TRIMS for an SSD volume. The operation is run across whole length of the file system.
The return values are the same as for the vxfs_ts_reclaim() API. See the vxfs_ts_reclaim(3) manual page. The -R option cannot be combined with any other options.
-S {shared|compressed|all}
  Reports on space savings due to sharing (shared) or compression (compressed), or to both sharing and compression (all). The output contains the following columns:
Mountpoint The mount point.
Size(KB) Total file system capacity, in kilobytes.
Available(KB)
  Free space of the file system, in kilobytes.
Used(KB) Consumed space, in kilobytes.
Logical Size(KB)
  Logical space consumed, in kilobytes. This value represents the actual disk space needed if there were no savings of the designated type.
Saved Percentage of the logical space saved. This number ranges from 0% to something less than 100%, with larger numbers representing greater savings.
The -S option is supported only on file systems with disk layout Version 8 or later.
-s Prints a summary of activity at the end of each pass.
-T time Maximum time to run. Reorganizations are processed until reorganization is complete, or until the time limit expires. time is specified in seconds.
-t vxfs Specifies the VxFS file system type.
-v Specifies verbose mode. Reports reorganization activity.

Largefiles Flag

Large files (files larger than 2 gigabytes) can be created if the file system has the largefiles flag set. This flag is set by default when the file system is created.

The -o largefiles and -o nolargefiles options change the largefiles flag, allowing or disallowing large files (files larger than 2 GB) in the file system. Clearing the flag via the -o nolargefiles option succeeds only if the flag is set and there are no large files present on the file system. See the mkfs_vxfs(1M) and mount_vxfs(1M) manual pages for information on creating and mounting file systems with large files.

The -o largefiles and -o nolargefiles options are the only fsadm options that can be used on an unmounted file system. An unmounted file system can be specified by invoking fsadm with a special device rather than a mount point. If you specify an unmounted file system, that file system must be clean.

Changing the largefiles flag may require changes to /etc/fstab. For example, if fsadm is used to set the largefiles flag, but nolargefiles is specified as a mount option in /etc/fstab, the file system is not mountable.

Defragmentation

For optimal performance, the kernel extent allocator must be able to find large extents when it wants them. To maintain file system performance, run fsadm periodically against all VxFS file systems to reduce fragmentation. The frequency depends on file system usage and activity patterns, and the importance of performance; typically between once a day and once a month against each file system. The -v option can be used to examine the amount of work performed by fsadm. You can adjust the frequency of reorganization based on the rate of file system fragmentation.

Running fsadm with Storage Checkpoints enabled can also affect Storage Checkpoint quota usage. See the NOTES section on Storage Checkpoint quotas.

There are two options that are available to control the amount of work done by fsadm during extent reorganization. The -t option specifies a maximum length of time to run. The -p option specifies a maximum number of passes to run. If both are specified, fsadm exits if either of the terminating conditions is reached. By default, fsadm runs five passes. If both the -e and -d options are specified, fsadm runs all the directory reorganization passes before any extent reorganization passes. The -C option can be used to defragment the free space of the file system.

fsadm uses the file .fsadm in the lost+found directory as a lock file. When fsadm is invoked, it opens the file lost+found/.fsadm in the root of the file system specified by mount_point. If .fsadm does not exist, it is created. The fcntl system call (see the fcntl(2) manual page) obtains a write lock on the file. If the write lock fails, fsadm assumes that another instance of fsadm is running and fails. fsadm reports the process ID of the process holding the write lock on the .fsadm file.

File System Resizing

If the -b option is specified, fsadm resizes the file system whose mount point is mount_point. If newsize is larger than the current size of the file system, the file system is expanded to newsize sectors. Similarly, if newsize is smaller than the current size of the file system, fsadm shrinks the file system to newsize sectors.

If there are file system resources in use in the sectors being removed, fsadm relocates those resources to sectors staying within the resized file system. The time needed for relocation depends on the number of blocks being moved.

The fsadm command cannot resize multi-volume file systems. See the fsvoladm(1M) manual page for information on resizing multi-volume file systems.

Reporting On Directory Fragmentation

As files are allocated and deallocated, directories tend to grow and become sparse. In general, the directory size is determined by the largest number of files it has ever contained, even if some files were subsequently removed.

To obtain a directory fragmentation report, use the command syntax:


fsadm -D [-r rawdev] mount_point

The following is some example output from the fsadm -D command:


# fsadm -t vxfs -D /var

Directory Fragmentation Report

Dirs Total Immed Immeds Dirs to Blocks Searched Blocks Dirs to Add Reduce to Reduce

total 486 99 388 6 6 6

The Dirs Searched column contains the total number of directories. A directory is associated with the extent-allocation unit containing the extent in which the directory’s inode is located. The Total Blocks column contains the total number of blocks used by directory extents.

The Immed Dirs column contains the number of directories that are immediate, meaning that the directory data is in the inode itself, as opposed to being in an extent. Immediate directories save space and speed up path name resolution.

The Immeds to Add column contains the number of directories that currently have a data extent, but that could be reduced in size and contained entirely in the inode.

The Dirs to Reduce column contains the number of directories for which one or more blocks could be freed if the entries in the directory are compressed to make the free space in the directory contiguous. Because directory entries vary in length, some large directories may contain a block or more of total free space, but with the entries arranged in such a way that the space cannot be made contiguous. As a result, it is possible to have a non-zero Dirs to Reduce calculation immediately after running a directory reorganization. The -v (verbose) option of directory reorganization reports occurrences of failure to compress free space.

The Blocks to Reduce contains the number of blocks that could be freed if the entries in the directory are compressed.

Measuring Directory Fragmentation

If the totals in the Dirs to Reduce column are substantial, a directory reorganization can improve the performance of path name resolution. The directories that fragment tend to be the directories with the most activity. A small number of fragmented directories can account for a large percentage of name lookups in the file system.

Directory Reorganization

If the -d option is specified, fsadm reorganizes the directories on the file system whose mount point is mount_point. Directories are reorganized in two ways: compression and sorting.

For compression, fsadm moves valid entries to the front of the directory and groups the free space at the end of the directory. If there are no entries in the last block of the directory, the block is released and the directory size is reduced.

If the total space used by all directory entries is small enough, fsadm puts the directory in the inode immediate data area.

The command syntax for reorganizing directories in a file system is:


fsadm -d [-D][-s][-v][-p passes] [-t time][-r rawdev] mount_point

The following example shows the output of the fsadm -d -D command:


# fsadm -t vxfs -d -D -s /opt

Directory Fragmentation Report

Dirs Total Immed Immeds Dirs to Blocks Searched Blocks Dirs to Add Reduce to Reduce

total 34663 8800 26655 2569 2716 2836

Directory Reorganization Statistics (pass 1 of 2)

Dirs Dirs Total Failed Blocks Blocks Immeds Searched Changed Ioctls Ioctls Reduced Changed Added

fset 999 8008 3121 5017 0 3037 4428 2569 total 8008 3121 5017 0 3037 4428 2569

Directory Reorganization Statistics (pass 2 of 2)

Dirs Dirs Total Failed Blocks Blocks Immeds Searched Changed Ioctls Ioctls Reduced Changed Added

fset 999 5439 552 2448 0 708 4188 0 total 5439 552 2448 0 708 4188 0

Directory Fragmentation Report

Dirs Total Immed Immeds Dirs to Blocks Searched Blocks Dirs to Add Reduce to Reduce

total 34663 6231 29224 0 147 267

The Dirs Searched column contains the number of directories searched. Only directories with data extents are reorganized. Immediate directories are skipped. The Dirs Changed contains the number of directories for which a change was made.

The Total Ioctls column contains the total number of VX_DIRSORT ioctls performed. Reorganization of directory extents is performed using this ioctl.

The Failed Ioctls column contains the number of requests that failed. The reason for failure is usually that the directory being reorganized is active. A few failures are typical in most file systems. If the -v option is specified, all ioctl calls and status returns are recorded.

The Blocks Reduced column contains the total number of directory blocks freed by compressing entries. The Blocks Changed column contains the total number of directory blocks updated while sorting and compressing entries.

The Immeds Added column contains the total number of directories with data extents that were compressed into immediate directories.

Reporting on Extent Fragmentation

As files are created and removed, over time the free extent map for an allocation unit changes from having one large free area to having many smaller free areas. This process is known as fragmentation. Also, when files increase in size (particularly when growth occurs in small increments), small files can be allocated in multiple extents. In the best case, each file that is not sparse has exactly one extent (containing the entire file), and the free-extent map is one continuous range of free blocks.

Determining Fragmentation

To determine whether a file system is fragmented, the free extents for that file system must be examined. If a large number of small extents are free, there is fragmentation.

Fragmentation can also be determined based on fragmentation index. Two types of indices are generated by fsadm: the file fragmentation index and the free space fragmentation index. The fragmentation index is an integer value between 0 and 100, which gives an idea about the level of file fragmentation and free space fragmentation. A value of 0 for the fragmentation index means no fragmentation, and value of 100 means the highest level of fragmentation. Based on the index, you should use the appropriate defragmentation option with the fsadm command. For example if the file fragmentation index is high, you should run fsadm with the -e option. If the if free space fragmentation index is high, you should run fsadm with the -C option. When you run fsadm with the -e option, internally the command performs free space defragmentation before performing file defragmentation.

After running file defragmentation using the -e option, the file fragmentation index is reduced. Similarly, after running free space defragmentation using the -C option, the free space fragmentation index is reduced. Sometimes the free space fragmentation index can increase after running file defragmentation depending on the geometry of files and free space on the device. Similarly, the file fragmentation index can be affected after running free space defragmentation.

Running The Extent-fragmentation Report

The extent-fragmentation report provides detailed information about the degree of fragmentation in a given file system.

The command syntax for an extent-fragmentation report is:


fsadm -E [-l largesize] [-r rawdev] mount_point

The extent reorganization facility considers certain extents to be immovable, that is, if the file already contains large extents, reallocating and consolidating these extents does not improve performance. The -l option controls when fsadm considers an extent immovable. By default, largesize is 64 blocks. For the extent-fragmentation report, the value for largesize affects which extents are reported as being immovable extents.

The following is an example of the output generated by the fsadm -E command:


# fsadm -t vxfs -E /home

File System Extent Fragmentation Report

Free Space Fragmentation Index : 80 File Fragmentation Index : 70

# Files Fragmented by Fragmentation Index 0 1-25 26-50 51-75 76-100 7838181 3774 82836 281144 8080449

Total Average Average Total Files File Blks # Extents Free Blks 16286384 35 3 223929219 blocks used for indirects: 2118188 % Free blocks in extents smaller than 64 blks: 50.16 % Free blocks in extents smaller than 8 blks: 5.51 % blks allocated to extents 64 blks or larger: 27.65 Free Extents By Size 1: 2030799 2: 2191290 4: 1481008 8: 2722184 16: 2068982 32: 1409601 64: 830567 128: 288308 256: 63579 512: 9186 1024: 551 2048:       0 4096: 0 8192: 0 16384:    0 32768: 0 65536: 0 131072:       0 262144: 0 524288: 0 1048576: 0 2097152: 0 4194304: 0 8388608: 0 16777216: 0 33554432: 0 67108864: 0 134217728: 0 268435456: 0 536870912: 0 1073741824: 0 2147483648: 0

The free space fragmentation index gives an idea of the fragmentation of the free space of the file system. The file fragmentation index gives an idea of the fragmentation of the files in the file system. A value of 0 for the fragmentation index means no fragmentation, and a value of 100 means the highest level of fragmentation.

The report also contains the number of files in each bucket of fragmentation index. Each file can fall in one of the 5 buckets defined based on its fragmentation index. The first bucket contains the number of files that are not fragmented at all, the second bucket contains the number of files whose fragmentation index is between 1 and 25, inclusive, and so on.

The numbers in the Total Files column indicate the total number of files in the file system. This column also contains some internal files.

The Average File Blks column contains the average number of blocks belonging to files with extents.

The Average # Extents column contains the average number of extents used by files in the file system.

The Total Free Blks column contains the total number of free blocks in the file system. The total number of blocks used for indirect address extent are reported as blocks used for indirects.

The general shape of free extent map is also reported. There are two percentages reported: % free extents smaller than 64 blocks and % free extents smaller than 8 blocks. These numbers are typically near zero on an unfragmented file system.

Another metric reported is the percentage of blocks that are part of extents 64 blocks or larger. Files with a single small extent are not included in this calculation. This number is typically large on file systems that contain many large files and is small on file systems that contain many small files.

The figures under the heading Free Extents By Size indicate the totals for free extents of each size. The totals are for free extents of size 1, 2, 4, 8, 16... up to a maximum of the number of data blocks in an allocation unit. The totals are similar to the output of the df -o command unless there was recent allocation or deallocation activity (because fsadm acts on mounted file systems). These figures provide an indication of fragmentation and extent availability on a file system.

Extent Reorganization

If the -e option is specified, fsadm reorganizes data extents on the file system whose mount point is mount_point. The primary goal of extent reorganization is to defragment the file system.

To reduce fragmentation, extent reorganization tries to place all small files into one contiguous extent. The -l option specifies the size of a file that is considered large. The default is 64 blocks. Extent reorganization also tries to group large files into large extents of at least 64 blocks. Extent reorganizations can improve performance. Small files can be read or written in one I/O operation, and large files can approach raw-disk performance for sequential I/O operations.

fsadm performs extent reorganization on all inodes in the file system. Each pass through the inodes moves the file system closer to optimal organization.

The fsadm command with the -e option reduces file fragmentation in each pass and can also reduce free extent fragmentation. In current versions of VxFS, fsadm relies on VxFS kernel allocation mechanisms to reallocate files in a more favorable extent geometry. At the same time, the kernel allocation mechanism is prevented from using blocks in areas of the free list that fsadm tries to make more contiguous.

The command syntax to perform extent reorganization is:


fsadm -e [-E][-s][-v][-l largesize][-p passes] [-i] [-r rawdev][-t time] mount_point

The following example shows the output from the fsadm -e -s command:


# fsadm -t vxfs -e -s /mnt4

Pass 1 Statistics Extents Reallocations Ioctls Errors Searched Attempted Issued FileBusy NoSpace Total total 2016 1473 789 0 0 0

Pass 2 Statistics Extents Reallocations Ioctls Errors Searched Attempted Issued FileBusy NoSpace Total total 1836 0 0 0 0 0

In this example, the default five passes were scheduled, but the reorganization completed in two passes.

This file system had a significant amount of free space although there were several free small extents. The situation was corrected by reallocating one or more of the extents on many of the files. The files selected for reallocation in this case are those with extents in the heavily fragmented section of the allocation units. The time it takes to complete extent reorganization varies, depending on the degree fragmentation, disk speed, and the number of inodes in the file system. In general, extent reorganization takes approximately one minute for every 100 megabytes of disk space.

The File Busy column (located under the heading Errors) shows the total number of reorganization requests that failed because the file was active during reorganization. The NoSpace column (located under the heading Errors) contains the total number of reorganization requests that failed because an extent presumed free was allocated during the reorganization. The Total column (located under the heading Errors) is the total number of errors encountered during the reorganization and may include errors that were not included with FileBusy or NoSpace.

Reorganization operations on active file systems can exit with errors similar to the following examples:


UX:vxfs fsadm: ERROR: V-3-20022: bad ilist extent UX:vxfs fsadm: ERROR: V-3-20269: failed to process primary inode list for fileset 999

In such a case, rerun the reorganization operation.

The following command performs an extent reorganization on all individual files under the mount point mnt1:


find /mnt1 -print | fsadm -t vxfs -e -f -

The fsadm command generates the following output when you request an extent fragmentation report on a file:

fsadm -t vxfs -E -f /home/file                 File Fragmentation Report

# File # File # Blocks Fragmentation Blocks Extents In Indirects Index 1033 129 8 42

The output contains the number of blocks allocated to the file, the number of extents, the number of blocks allocated in indirects, and the fragmentation index of the file.

The following command performs free space fragmentation on the file system /home:


fsadm -t vxfs -C /home Free Space Fragmentation Index : 64 Free Extents By Size 1: 17767 2: 6680 4: 17198 8: 6596 16: 9897 32: 8376 64: 10329 128: 2753 256: 249 512: 75 1024: 30 2048: 4 4096: 2 8192: 0 16384: 0 32768: 1 65536: 3 131072: 1 262144: 4 524288: 6 1048576: 1 2097152: 0 4194304: 1 8388608: 2 16777216: 0 33554432: 0 67108864: 0 134217728: 0 268435456: 0 536870912: 0 1073741824: 0 2147483648: 0

Free Space Fragmentation Index : 27 Free Extents By Size 1: 6628 2: 4902 4: 5609 8: 1542 16: 790 32: 782 64: 768 128: 442 256: 15 512: 6 1024: 1 2048: 2 4096: 1 8192: 1 16384: 1 32768: 15 65536: 10 131072: 2 262144: 6 524288: 6 1048576: 1 2097152: 0 4194304: 1 8388608: 2 16777216: 0 33554432: 0 67108864: 0 134217728: 0 268435456: 0 536870912: 0 1073741824: 0 2147483648: 0

The -C option provides the free space fragmentation index and free extents by size before and after performing free space defragmentation. The file system had large number of free space in small extents before running defragmentation. The fragmentation index was 64 before. After running one pass of free space defragmentation, the index came down to 27, the free space in small extents reduced, and the free space in larger extents increased. You can run fsadm -C multiple times for better results. Because of how fsadm selects blocks for movement during free space defragmentation, after some runs there might not be much reduction in the fragmentation index.

Reorganization Prevention

Some specific applications may prevent extent and log reorganization from taking place by creating the /etc/vx/vxfs_noreorg_config file. When this file exists and the fsadm command options specified would result in either an extent (-e) or log reorganization, fsadm will return an error with the proper notification. The /etc/vx/vxfs_noreorg_config file should not be created or removed arbitrarily. Only those applications with explicit knowledge and need would create the file, and remove it when the need no longer exists. This method of reorganization prevention may be removed at any time without prior notice, and should not be depended on.

FILES

lost+found/.fsadm Lock file.
/dev/vx/rdsk* File system devices.
/etc/fstab Contains static information about file systems.

SEE ALSO

df_vxfs(1M), fsckptadm(1M), mkfs_vxfs(1M), mount_vxfs(1M), fcntl(2), vxfs_ts_reclaim(3), fstab(5), vxfsio(7)


VxFS 7.4 fsadm_vxfs(1M)