< Previous | Next > | |
Product: File System Manual Pages for Storage Foundation | |
Manual: Maintenance Commands (1m) |
fsadm_vxfsNAMEfsadm_vxfs - resize or reorganize (defragment) a VxFS file system SYNOPSISfsadm [-F vxfs] [-d] [-D] [-e] [-E] [-s] [-v] [-a days][-k ckpt_name][-l largesize][-p passes] [-r rawdev][-t time] mount_point fsadm [-F vxfs] [-b newsize] [-r rawdev] mount_point fsadm [-F vxfs] [-c] mount_point fsadm [-F vxfs] [-o specific_options] mount_point | special fsadm [-F vxfs] [-d] [-D] [-e] [-E] -f filename | - fsadm [-F vxfs] [-L] mount_point AVAILABILITYDESCRIPTIONThe 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, and querying or changing the largefiles flag. 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 its Storage Checkpoints. CLUSTER FILE SYSTEM ISSUESFor a cluster mounted file system, you must run fsadm from the primary node of the cluster, and the primary must be mounted with read and write access. fsadm fails if run from one of the secondary mounts. You can use the fsclustadm showprimary mount_point command to determine which cluster node is the primary before you run fsadm. OPTIONSIf 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. Considers files not accessed within the specified number of days as "aged" files. The default is 14 days. The -d option moves aged files to the end of the directory. Resizes the file system to newsize sectors. -b cannot be used with the -cdDeEfko options. Converts the inode format of files upgraded from the Version 2 disk layout so that they can grow beyond a two gigabyte offset. This option is required because some file systems that are upgraded (see vxupgrade(1M)) from the older disk layout versions could not be extended past 2 GB or contain more than 8 million inodes. 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. Reports on directory fragmentation. If specified with the -d option, the fragmentation report is produced both before and after the directory reorganization. Extent reorganization. Minimizes file system fragmentation. Files are reorganized to have the minimum number of extents. Reports on extent fragmentation. If specified with the -e option, the fragmentation report is produced both before and after the extent reorganization. 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. Specifies the VxFS file system type. Reorganizes or reports directories or extent fragmentation on the specified Storage Checkpoint. 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. Queries the current size of the intent log as well as the volume on which it resides. On single-volume file systems, logvol will be empty. Specifies VxFS-specific options. 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. 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"). Note 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. See the logsize specific option of the mkfs_vxfs(1M) manual page for more information on log sizes. 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. 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. Note 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. The -o option cannot be used with the -bcdDeEfk options. 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. 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. Prints a summary of activity at the end of each pass. Maximum time to run. Reorganizations are processed until reorganization is complete, or until the time limit expires. time is specified in seconds. Specifies verbose mode. Reports reorganization activity. LARGEFILES FLAGLarge 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. DEFRAGMENTATIONFor 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. There are two options that are available to control the amount of work done by fsadm . 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. 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 RESIZINGIf 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. In some circumstances, the fsadm command cannot resize a 100% full file system due to lack of space for updating structural information. Check VxFS file systems on a regular basis; increase their size if they approach 100% capacity. This problem can also occur if the file system is very busy. Free up space or reduce activity on the file system and try the resize again. 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 FRAGMENTATIONAs files are allocated and deallocated, directories tend to grow and become sparse. In general, a directory is as large as the largest number of files it 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 -F 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 column ''Dirs Searched'' 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 column ''Total Blocks'' contains the total number of blocks used by directory extents. The column ''Immed Dirs'' 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 column ''Immeds to Add'' 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 column ''Dirs to Reduce'' 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, it is possible that 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 column ''Blocks to Reduce'' contains the number of blocks that could be freed if the entries in the directory are compressed. MEASURING DIRECTORY FRAGMENTATIONIf the totals in the columns labeled ''Dirs to Reduce'' 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 REORGANIZATIONIf 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. fsadm also sorts directory entries to improve path name lookup performance. Entries are sorted based on the last access time of the entry. The -a option specifies a time interval; 14 days is the default if -a is not specified. The time interval is broken up into 128 ''buckets,'' and all times within the same buckets are considered equal. All access times older than the time interval are considered equal, and those entries are placed last. Subdirectory entries are placed at the front of the directory and symbolic links are placed after subdirectories, followed by the most-recently-accessed files. The command syntax for reorganizing directories in a file system is: fsadm -d [-D][-s][-v][-a days][-p passes] [-t time][-r rawdev] mount_point The following example shows the output of the fsadm -d -D command: # fsadm -F 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 column ''Dirs Searched'' contains the number of directories searched. Only directories with data extents are reorganized. Immediate directories are skipped. The column ''Dirs Changed'' contains the number of directories for which a change was made. The column ''Total Ioctls'' contains the total number of VX_DIRSORT ioctls performed. Reorganization of directory extents is performed using this ioctl. The column ''Failed Ioctls'' 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 column ''Blocks Reduced'' contains the total number of directory blocks freed by compressing entries. The column ''Blocks Changed'' contains the total number of directory blocks updated while sorting and compressing entries. The column ''Immeds Added'' contains the total number of directories with data extents that were compressed into immediate directories. REPORTING ON EXTENT FRAGMENTATIONAs 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 FRAGMENTATIONTo 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. If more than half of the amount of free space is used by small extents (smaller than 64 blocks), or there is less than 5 percent of total file system space available in large extents, there is serious fragmentation. RUNNING THE EXTENT-FRAGMENTATION REPORTThe 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 -F vxfs -E /home Extent Fragmentation Report Total Average Average Total Files File Blks # Extents Free Blks 939 11 2 245280 blocks used for indirects: 0 % Free blocks in extents smaller than 64 blks: 8.35 % Free blocks in extents smaller than 8 blks: 4.16 % blks allocated to extents 64 blks or larger: 45.81 Free Extents By Size 1: 356 2: 292 4: 271 8: 181 16: 23 32: 7 64: 3 128: 1 256: 1 512: 0 1024: 1 2048: 1 4096: 2 8192: 2 16384: 1 32768: 2 The numbers in the column ''Total Files'' indicate the total number of files that have data extents. The column ''Average File Blks'' contains the average number of blocks belonging to all files. The column ''Average # Extents'' contains the average number of extents used by files in the file system. The column ''Total Free Blks'' 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 REORGANIZATIONIf 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. fsadm reduces both file fragmentation and free extent fragmentation in each pass. 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] [-r rawdev][-t time] mount_point The following example shows the output from the fsadm -e -s command: # fsadm -F vxfs -e -s /mnt1 Extent Fragmentation Report Total Average Average Total Files File Blks # Extents Free Blks 939 11 2 245280 blocks used for indirects: 0 % Free blocks in extents smaller than 64 blks: 8.35 % Free blocks in extents smaller than 8 blks: 4.16 % blks allocated to extents 64 blks or larger: 45.81 Free Extents By Size 1: 356 2: 292 4: 271 8: 181 16: 23 32: 7 64: 3 128: 1 256: 1 512: 0 1024: 1 2048: 1 4096: 2 8192: 2 16384: 1 32768: 2 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 Extent Fragmentation Report Total Average Average Total Files File Blks # Extents Free Blks 939 11 1 245280 blocks used for indirects: 0 % Free blocks in extents smaller than 64 blks: 0.46 % Free blocks in extents smaller than 8 blks: 0.03 % blks allocated to extents 64 blks or larger: 45.53 Free Extents By Size 1: 10 2: 1 4: 1 8: 4 16: 3 32: 4 64: 3 128: 3 256: 3 512: 4 1024: 4 2048: 2 4096: 3 8192: 1 16384: 1 32768: 2 Note 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. In the preceding example, the column ''Extents Searched'' contains the total number of extents examined. The column ''Reallocations Attempted'' contains the total number of consolidations or merging of extents performed. The column ''Ioctls Issued'' contains the total number of reorganization request calls made during the pass. This corresponds closely to the number of files that are being operated on in that pass, as most files can be reorganized with a single ioctl. More than one extent may be consolidated in one operation. The column ''File Busy'' (located under the heading ''Errors'') shows the total number of reorganization requests that failed because the file was active during reorganization. The column ''NoSpace'' (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 column ''Total'' (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.'' The following command performs an extent reorganization on all individual files under the mount point mnt1: find /mnt1 -print | fsadm -F vxfs -e -f - FILESContains static information about file systems. SEE ALSOdf_vxfs (1M), fsckptadm (1M), fsclustadm (1M), mkfs_vxfs (1M), mount_vxfs (1M), vxupgrade (1M), fcntl(2), fstab(4), vxfsio (7) |
^ Return to Top | < Previous | Next > |
Product: File System Manual Pages for Storage Foundation | |
Manual: Maintenance Commands (1m) | |
VERITAS Software Corporation
www.veritas.com |