fsadm_vxfs(1M) fsadm_vxfs(1M)
NAME [Toc] [Back]
fsadm_vxfs: fsadm - resize or reorganize a VxFS file system
SYNOPSIS [Toc] [Back]
fsadm [-F vxfs] [-V] [-d] [-D] [-e] [-E] [-s] [-v] [-a days]
[-k ckpt_name] [-l largesize] [-p passes] [-r rawdev] [-t time]
mount_point
fsadm [-F vxfs] [-V] [-b newsize] [-r rawdev] mount_point
fsadm [-F vxfs] [-V] [-o largefiles|nolargefiles]
mount_point|special
fsadm [-F vxfs] [-V] [-c] mount_point
fsadm [-F vxfs] [-V] [-d] [-D] [-e] [-E] -f filename | -
DESCRIPTION [Toc] [Back]
fsadm performs online administration functions on VxFS file systems,
Storage Checkpoints, or individual files and directories. fsadm
supports file-system resizing, extent reorganization, directory
reorganization, and querying or changing the largefiles flag. fsadm
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.
VxFS file systems running on HP-UX 10.20 and later contain features
that are incompatible with earlier versions of HP-UX and applications.
These features are large files (file sizes greater than two
gigabytes), and hierarchical storage management via the DMAPI (Data
Management Applications Programming Interface).
The online reorganization and online resize features of fsadm are
available only with the HP OnLineJFS product.
Options [Toc] [Back]
fsadm recognizes the following options:
-a days Consider 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. The -a days option applies only with
-d.
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
fsadm_vxfs(1M) fsadm_vxfs(1M)
-b newsize Resize the file system to newsize sectors. -b cannot
be used with the -cdDeEo options.
-c Convert 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 upgraded from the Version 2 disk
layout could not be extended past two gigabytes or
contain more than 8 million inodes.
-d Reorganize 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.
-D Report on directory fragmentation. If specified in
conjunction with the -d option, the fragmentation
report is produced both before and after the
directory reorganization.
-e Reorganize extents. Minimize file system
fragmentation. Files are reorganized to have the
minimum number of extents.
-E Report on extent fragmentation. If specified in
conjunction 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.
-F vxfs Specify the VxFS file system type.
-k ckpt_name
Reorganizes or reports directories or extent
fragmentation on the specified Storage Checkpoint.
-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
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003
fsadm_vxfs(1M) fsadm_vxfs(1M)
and 2048 blocks. The default is 64 blocks. The -l
largesize option applies only with -E or -e.
-o specific_options
Specify options specific to the vxfs file system type.
The following specific_options are valid on a VxFS file
system:
largefiles
Set 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.
nolargefiles
Clear the largefiles flag for the file system.
When this 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.
The -o option cannot be used with the -bcdDeE options.
Note: Large files are supported on HP-UX 10.20 systems
and above. 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.
-p passes Maximum number of passes to run. The default is 5
passes. Reorganizations are processed until
reorganization is complete, or the specified number of
passes are run.
-r rawdev Pathname of raw device to read to determine file layout
and fragmentation. This option can be used when fsadm
cannot determine the raw device.
-s Print a summary of activity at the end of each pass.
-t time Maximum time to run. Reorganizations are processed
until reorganization is complete, or the time limit has
expired. time is specified in seconds.
Hewlett-Packard Company - 3 - HP-UX 11i Version 2: August 2003
fsadm_vxfs(1M) fsadm_vxfs(1M)
-V Echo the completed command line, but do not execute the
command. The command line is generated by
incorporating the user-specified options. This option
allows the user to verify the command line.
-v Specify verbose mode. Report reorganization activity.
If no options are specified, fsadm prints the current largefiles flag
setting, then exits. The -b, -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.
Operands [Toc] [Back]
fsadm recognizes the following operands:
mount_point Name of the mount_point for a mounted VxFS file.
special Name of a special device containing a clean,
unmounted file system.
Largefiles Flag [Toc] [Back]
Files larger than two gigabytes are called large files. The -o
largefiles and -o nolargefiles options change the largefiles flag,
allowing or disallowing large files in the file system.
Large files can be created only on file systems with disk layout
Version 3 or above. A file system with large files cannot be mounted
on an HP-UX system older than HP-UX 10.20. Many existing applications
cannot operate on large files.
Setting the flag with the -o largefiles option succeeds only if the
file system has the Version 3 disk layout or above. See vxupgrade(1M)
for information on how to upgrade a file system from an older disk
layout to the current version. Clearing the flag with the -o
nolargefiles option succeeds only if the flag is set and there are no
large files present on the file system. See mkfs_vxfs(1M) and
mount_vxfs(1M) 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 an unmounted file system is specified,
it 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 files system is not
mountable.
Hewlett-Packard Company - 4 - HP-UX 11i Version 2: August 2003
fsadm_vxfs(1M) fsadm_vxfs(1M)
Defragmentation [Toc] [Back]
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.
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 5 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 the file does not
exist, it is created. The fcntl(2) system call 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 [Toc] [Back]
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.
Increasing the size of a file system requires that the file system
contain enough free space, prior to the expansion, for the growth of
the structural files. In the case where a file system has no free
blocks available, the attempt to increase the size of the file system
will fail (see extendfs(1M) for an alternate method to increase file
system size).
In a Version 3 or above disk layout, 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 older disk layouts, file system structural components are fixed, so
reducing the size of a file system fails if there are file system
resources in use in the sectors being removed. In that case, a
reorganization (using fsadm -e) can free busy resources and allow
shrinking the file system. If there are still file system structural
Hewlett-Packard Company - 5 - HP-UX 11i Version 2: August 2003
fsadm_vxfs(1M) fsadm_vxfs(1M)
components within the area to be removed, you must upgrade the file
system to a Version 3 or above disk layout to do a resize (see
vxupgrade(1M)).
Reporting on Directory Fragmentation [Toc] [Back]
As files are allocated and freed, 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 /lhome
Directory Fragmentation Report [Toc] [Back]
Dirs Total Immed Immeds Dirs to Blocks to
Searched Blocks Dirs to Add Reduce Reduce
total 15 3 12 0 0 0
The column labeled "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 labeled "Total Blocks" contains the total number of blocks
used by directory extents.
The column labeled "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 pathname resolution. The column labeled "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 labeled "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. Since 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 nonzero
"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 labeled "Blocks to Reduce" contains the number of blocks
that could be freed if the entries in the directory are compressed.
Hewlett-Packard Company - 6 - HP-UX 11i Version 2: August 2003
fsadm_vxfs(1M) fsadm_vxfs(1M)
Measuring Directory Fragmentation [Toc] [Back]
If the totals in the columns labeled "Dirs to Reduce" are substantial,
a directory reorganization can improve performance of pathname
resolution. The directories that fragment tend to be the directories
with the most activity. A small number of fragmented directories may
account for a large percentage of name lookups in the file system.
Directory Reorganization [Toc] [Back]
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.
fsadm also sorts directory entries to improve pathname 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 bucket 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] [-v] [-s] [-a days] [-p passes] [-r rawdev] [-t time]
mount_point
The following example shows the output of the fsadm -d -D command:
#fsadm -F vxfs -d -D -s /opt
Directory Fragmentation Report [Toc] [Back]
Dirs Total Immed Immeds Dirs to Blocks to
Searched Blocks Dirs to Add Reduce Reduce
total 34663 8800 26655 2569 2716 2836
Directory Reorganization Statistics (pass 1 of 2) [Toc] [Back]
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
Hewlett-Packard Company - 7 - HP-UX 11i Version 2: August 2003
fsadm_vxfs(1M) fsadm_vxfs(1M)
Directory Reorganization Statistics (pass 2 of 2) [Toc] [Back]
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 [Toc] [Back]
Dirs Total Immed Immeds Dirs to Blocks to
Searched Blocks Dirs to Add Reduce Reduce
total 34663 6231 29224 0 147 267
The column labeled "Dirs Searched" contains the number of directories
searched. Only directories with data extents are reorganized.
Immediate directories are skipped. The column labeled "Dirs Changed"
contains the number of directories for which a change was made.
The column labeled "Total Ioctls" contains the total number of
VX_DIRSORT ioctls performed. Reorganization of directory extents is
performed using this ioctl.
The column labeled "Failed Ioctls" contains the number of requests
that failed for some reason. The reason for failure is usually that
the directory being reorganized is active. A few failures should be
no cause for alarm. If the -v option is used, all ioctl calls and
status returns are recorded.
The column labeled "Blocks Reduced" contains the total number of
directory blocks freed by compressing entries. The column labeled
"Blocks Changed" contains the total number of directory blocks updated
while sorting and compressing entries.
The column labeled "Immeds Added" contains the total number of
directories with data extents that were compressed into immediate
directories.
Reporting on Extent Fragmentation [Toc] [Back]
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 would have exactly one extent
(containing the entire file), and the free-extent map is one
continuous range of free blocks.
Conversely, in a case of extreme fragmentation, there can be free
space in the file system, none of which can be allocated. For
example, on Version 2 disk layouts, the indirect-address extent size
is always 8K long. This means that to allocate an indirect-address
extent to a file, an 8K extent must be available. If no extent of 8K
byes or larger is available, even though more than 8K of free space is
Hewlett-Packard Company - 8 - HP-UX 11i Version 2: August 2003
fsadm_vxfs(1M) fsadm_vxfs(1M)
available, an attempt to allocate a file into indirect extents fails
and returns ENOSPC.
Determining Fragmentation [Toc] [Back]
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, then there is fragmentation. If more than half of the
amount of free space is taken up by small extents (smaller than 64
blocks), or there is less than 5 percent of total file system space
available in large extents, then there is serious fragmentation.
Running the Extent-Fragmentation Report [Toc] [Back]
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 some extents to be
immovable: that is, if reallocating and consolidating extents does not
improve performance, those extents are considered immovable. For
example, if a file already contains large extents, reallocating and
consolidating these extents does not improve performance. The -l
option controls when fsadm considers an extent as immovable. By
default, largesize is 64 blocks, meaning that any extent larger than
64 blocks is considered to be immovable. 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 [Toc] [Back]
Total Average Average Total
Files File Blks # Extents Free Blks
9293 115 1 149352
blocks used for indirects: 48
% Free blocks in extents smaller than 64 blks: 10.40
% Free blocks in extents smaller than 8 blks: 0.56
% blks allocated to extents 64 blks or larger: 91.67
Free Extents By Size
1: 156 2: 140 4: 101
8: 292 16: 290 32: 241
64: 155 128: 94 256: 43
512: 33 1024: 20 2048: 1
4096: 1 8192: 1 16384: 1
32768: 1 65536: 0 131072: 0
262144: 0 524288: 0 1048576: 0
Hewlett-Packard Company - 9 - HP-UX 11i Version 2: August 2003
fsadm_vxfs(1M) fsadm_vxfs(1M)
2097152: 0 4194304: 0 8388608: 0
16777216: 0 33554432: 0 67108864: 0
134217728: 0 268435456: 0 536870912: 0
1073741824: 0 2147483648: 0
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 generally 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 [Toc] [Back]
If the -e option is specified, fsadm reorganizes the 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 in 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 reorganization can improve
performance. Small files can be read or written in one I/O operation.
Large files can approach raw-disk performance for sequential I/O
operations.
fsadm performs extent reorganization on all inodes on the file system.
Each pass through the inodes will move the file system closer to
optimal organization.
Hewlett-Packard Company - 10 - HP-UX 11i Version 2: August 2003
fsadm_vxfs(1M) fsadm_vxfs(1M)
fsadm reduces both file fragmentation and free extent fragmentation in
each pass. In older versions of VxFS, considerable effort was made to
obtain an optimal file system layout. In current versions, 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] [-v] [-s] [-l largesize] [-p passes] [-r rawdev] [-t
time] mount_point
The following example shows the output from the fsadm -F vxfs -e -s -E
command:
# fsadm -F vxfs -e -s -E /home
Extent Fragmentation Report [Toc] [Back]
Total Average Average Total
Files File Blks # Extents Free Blks
9293 115 1 149352
blocks used for indirects: 48
% Free blocks in extents smaller than 64 blks: 10.40
% Free blocks in extents smaller than 8 blks: 0.56
% blks allocated to extents 64 blks or larger: 91.67
Free Extents By Size
1: 156 2: 140 4: 101
8: 292 16: 290 32: 241
64: 155 128: 94 256: 43
512: 33 1024: 20 2048: 1
4096: 1 8192: 1 16384: 1
32768: 1 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
Pass 1 Statistics [Toc] [Back]
Extents Reallocations Ioctls Errors
Searched Attempted Issued FileBusy NoSpace Total
total 12547 287 158 0 0 0
Pass 2 Statistics [Toc] [Back]
Extents Reallocations Ioctls Errors
Searched Attempted Issued FileBusy NoSpace Total
total 13157 148 72 0 0 0
Extent Fragmentation Report [Toc] [Back]
Total Average Average Total
Hewlett-Packard Company - 11 - HP-UX 11i Version 2: August 2003
fsadm_vxfs(1M) fsadm_vxfs(1M)
Files File Blks # Extents Free Blks
9294 123 1 70400
blocks used for indirects: 64
% Free blocks in extents smaller than 64 blks: 14.00
% Free blocks in extents smaller than 8 blks: 0.70
% blks allocated to extents 64 blks or larger: 92.09
Free Extents By Size
1: 102 2: 79 4: 59
8: 192 16: 189 32: 150
64: 64 128: 37 256: 22
512: 2 1024: 4 2048: 4
4096: 4 8192: 2 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
Note that the default five passes were scheduled, but the
reorganization finished 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 of 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 "FileBusy" (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 or errors encountered during the
reorganization and may include errors that were not included with
"FileBusy" or "NoSpace."
Hewlett-Packard Company - 12 - HP-UX 11i Version 2: August 2003
fsadm_vxfs(1M) fsadm_vxfs(1M)
The following command performs an extent reorganization on sll
individual files under the mount point /home.
find /home -print | fsadm -F vxfs -e -f -
FILES [Toc] [Back]
lost+found/.fsadm lock file
/dev/rdsk/* file system devices
/etc/fstab Contains static information about file
systems.
SEE ALSO [Toc] [Back]
df
, mount_vxfs(1M), vxupgrade(1M),
fcntl(2), fstab(4), vxfsio(7).
Hewlett-Packard Company - 13 - HP-UX 11i Version 2: August 2003 [ Back ] |