FSANALYZE(8)FSANALYZE(8)NAMEfsanalyze - a file system analyzer tool
SYNOPSISfsanalyze [ -deiov [ -b# ] [ -c# ] [ -g# ] ] special [ files ]
DESCRIPTION
Fsanalyze is a simple tool that estimates file or file system fragmen‐
tation. It accomplishes this by scanning the data blocks of each inode
looking for block numbers that are out of sequence. In effect, it is
counting the number of disk seeks required to read a file sequentially.
Fragmentation is then computed as the ratio of actual "seeks" to the
potential number "seeks" which would be required if the file were com‐
pletely fragmented.
If the optional files arguments are omitted, fsanalyze will analyze the
entire file system specified by the special argument. Special must be
a block-oriented file system device.
In addition to fragmentation, fsanalyze reports other useful file sys‐
tem statistics. These include:
Fragmentation The number of additional disk seeks necessary to
access all files in the file system sequentially.
Expressed as a percentage of the total possible
seeks if the file system were maximally frag‐
mented.
Average Seek Distance
The average distance, in cylinders, that the disk
head must travel when seeking due to file fragmen‐
tation.
Rotation Delay Even when data blocks reside on the same cylinder
of the disk, their relative placement may be such
that extra delays due to disk rotation result. A
heuristic is used to determine how many blocks are
non-optimally placed within a cylinder. Expressed
as a percentage of the total possible number of
delays if the file system were maximally frag‐
mented.
Multiply-linked Files
The number of inodes that are linked to more than
one file name. Expressed as an absolute number
and a percentage of the total number of active
inodes.
Directories The number of inodes that are being used as direc‐
tories. Expressed as an absolute number and a
percentage of the total number of active inodes.
Oversized Directories
If a directory grows large enough to require indi‐
rection, file searches are slowed down signifi‐
cantly. This metric reports the number of direc‐
tories that require indirection. Expressed as an
absolute number and a percentage of all the direc‐
tories on the file system.
Special Files The number of inodes that are actually special
(character or block devices). Expressed as an
absolute number and a percentage of all active
inodes.
Indirect Files The number of files that require at least one
level of indirection. Also includes files that
require multiple levels of indirection. Expressed
as an absolute number and a percentage of all
active inodes.
Double Indirects The number of files that require at least two lev‐
els of indirection. Expressed as an absolute num‐
ber and a percentage of all active inodes.
Triple Indirects The number of files that require three levels of
indirection (the maximum). Expressed as an abso‐
lute number and a percentage of all active inodes.
Indirection Blks The total number of data blocks that are being
used to hold indirect blocks. These blocks are
unavailable for data, and represent file system
overhead. Expressed as an absolute number and a
percentage of the total number of data blocks in
the file system.
Sparse Files In Unix, it is possible to create files with
"holes", i.e., no data, in the middle. This can
be done, for instance, by fseek-ing past the end
of file and writing to the file. Unix will not
allocate data blocks for parts of the file which
have never been written. Reading from an unallo‐
cated block returns all zeros. This can be used
to great advantage, since large yet sparse files
do not take up any more disk space than needed.
However, sparse files are often created inadver‐
tently, and can cause problems during backups if
the backup utility doesn't handle them correctly.
Expressed as an absolute number and a percentage
of all active inodes.
Unused Bytes in Last Blocks
The last block of a file is rarely completely
full. Because disk space is only allocated in
blocks, the unused bytes in these blocks are not
available for use by other files. This represents
another source of file system overhead. Expressed
as an absolute number and a percentage of the file
system size.
Fsanalyze also lists the 10 most fragmented inodes in the file system.
They are listed in decreasing order of fragmentation based on the abso‐
lute number of fragments. For example a 100-block file that contains
40 individual fragments is 39.39% fragmented (39 seeks / 99 potential
seeks), but is listed before a 2-block file that contains 2 fragments
(100% fragmented). This prevents very small, but fragmented, files
from being listed before larger files, which probably have a more sig‐
nificant impact on file system throughput.
If the files argument is present, fsanalyze will report the fragmenta‐
tion of the designated files only.
Before performing any analysis, fsanalyze checks the file system
integrity. If it is available, fsanalyze will make use of the utility
fsstat (1M). Otherwise, fsanalyze will do the best it can to determine
file system integrity by examining the super block. If the file system
needs to be checked, fsanalyze terminates with a message, unless over‐
ridden with the -o option. If a non-root file system is mounted, a
warning message is displayed, but analysis continues. When used on a
mounted file system, it is recommended that a sync (1) be performed
immediately prior to running fsanalyze . If sync (1) is not performed,
the file system will not be damaged, but erroneous statistics may be
reported.
OPTIONS
-b# assume '#' bytes per logical block -- by default, this value is
calculated automatically. Use this flag if the default value is
in error.
-c# assume '#' sectors per disk cylinder -- by default, this value
is determined by information in the superblock.
-d display inode numbers as they are examined. This flag makes it
easy to chart the progress of fsanalyze through the file system.
Used mainly for debugging.
-e report file size inconsistencies - the inode numbers are
reported for files where the file size and number of data blocks
are inconsistent. This option provides the same information as
fsck (1) phase 1.
-g# assume an inter-block gap of '#' sectors. By default this
information is taken from the superblock.
-i report double and triple indirection - the inode numbers are
reported for files that contain double and/or triple data-block
indirection.
-o overrides file system integrity checks. The file system will be
analyzed even if fsstat (1M) reports that it is damaged. Note
that fsanalyze may give erroneous results if used on a damaged
file system, but the file system itself will not be affected.
-v causes the current version number and patch level to be dis‐
played.
EXAMPLESfsanalyze /dev/dsk/0s2 # analyze file system
fsanalyze /dev/dsk/0s2 * # analyze files in current dir
FILES
/usr/include/sys/filesys.h super block structure
/usr/include/sys/ino.h disk inode structure
/usr/include/sys/param.h system parameters
/usr/include/sys/types.h system type definitions
BUGS
I don't trust the rotation delay statistics, especially for BSD file
systems.
SEE ALSOfsstat(1M), fsck(1M), fsdb(1M)AUTHOR
Michael J. Young
harvard!sdti!mjy
Internet : mjy@sdti.SDTI.COM
VERSION
4.1 - 88/11/16 17:29:54
FSANALYZE(8)