Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
fsstat [-a|f|i|n|v] [-T | u|d] {-F | {fstype|path}...} [interval [count]]
fsstat reports kernel file operation activity by the file system type (fstype) or by the path name, which is converted to a mount point. The first set of lines of output reports all activity since:
The file system module was loaded (in the case of fstype)
The file system was mounted (in the case of mount point)
Statistics are gathered at the file system independent layer at both the fstype and the mount point levels. However, not all file system types are represented in the gathering of statistics. (See the NOTES section of this man page.)
The output of fsstat is dependent on the mode (option) requested. All statistic fields are displayed using "smart numbers" which automatically scale the units in a human readable form that fits in a maximum of 5 characters. For example:
100
is displayed as 100
2048
is displayed as 2K
3000000
is displayed as 2.86M
The unit modifiers are: K (Kbyte), M (Mbyte), G (Gbyte), T (terabyte), P (petabyte), and E (exabyte).
During the execution of fsstat, the state of the system can change. If relevant, a state change message is included in the fsstat output in one of the following forms:
<<mount point no longer available: {path}>> <<file system module no longer loaded: {fstype}>>
After the state change messages are displayed, fsstat continues to display the statistics as directed. If all of the fstypes and mount points that fsstat was reporting on are no longer available, then fsstat exits.
The user is required to specify the -F option (all available file system types) or a list of one or more fstypes and/or mount points.
The default report shows general file system activity. This display combines similar operations into general categories as follows:
new file
Number of creation operations for file system objects (for example, files, directories, symlinks, etc.)
name remov
Number of name removal operations
name chng
Number of name change operations
attr get
Number of object attribute retrieval operations
attr set
Number of object attribute change operations
lookup ops
Number of object lookup operations
rddir ops
Number of read directory operations
read ops
Number of data read operations
read bytes
Bytes transferred by data read operations
write ops
Number of data write operations
write bytes
Bytes transferred by data write operations
The entity being reported on (fstype or mount point) is displayed in the last column.
The following options are supported:
-a
Report the activity for kernel attribute operations. The following statistics are reported:
getattr
Number of file attribute retrieval calls
setattr
Number of file attribute modification calls
getsec
Number of file security attribute retrieval calls
setsec
Number of file security attribute modification calls
-f
Report the full activity for all kernel file operations. Each file operation is listed in the left column. The following statistics are reported for each operation:
#ops
Number of calls for this operation
bytes
Average transfer size in bytes (only applies to read, write, readdir)
-i
Reports the activity for kernel I/O operations. The following statistics are reported:
read ops
Number of data read calls
read bytes
Number of bytes read
write ops
Number of data write calls
write bytes
Number of bytes written
rddir ops
Number of read directory calls
rddir bytes
Number of bytes read by reading directories
rwlock ops
Number of internal file system lock operations
rwulock ops
Number of internal file system unlock operations
-n
Reports the activity for kernel naming operations. The following statistics are reported:
lookup
Number of file name retrieval calls
creat
Number of file creation calls
remov
Number of file remove calls
link
Number of link calls
renam
Number of file renaming calls
mkdir
Number of directory creation calls
rmdir
Number of directory removal calls
rddir
Number of directory read calls
symlink
Number of symlink creation calls
rdlink
Number of symlink read calls
-v
Reports the activity for calls to the virtual memory operations. The following statistics are reported.
map
Number of calls mapping a file
addmap
Number of calls setting additional mapping to a mapped file
delmap
Number of calls deleting mapping to a file
getpag
Number of calls retrieving a page of data from a file
putpag
Number of calls writing a page of data to a file
pagio
Number of calls to transfer pages in file system swap files
-F
Report on all available file system types.
-T u|d
Display a time stamp. Specify u for a printed representation of the internal representation of time (see time(2)) Specify d for the standard date format. (See date(1)). The time stamp is only used when an interval is set.
The following operands are supported:
count
Display only count reports.
fstype
Explicitly specify the file system type(s) to be reported. The file system module must be loaded.
interval
Report once each interval seconds.
path
Specify the path(s) of the mount point(s) to be reported. If path is not a mount point, the mount point containing path will be determined and displayed in the output.
If no interval and no count are specified, a single report is printed and fsstat exits. If an interval is specified but no count is specified, fsstat prints reports every interval seconds indefinitely until the command is interrupted.
Example 1 Displaying General Activity
The following example shows general activity for all file system types.
$ fsstat -F
new name name attr attr lookup rddir read read write write
file remov chng get set ops ops ops bytes ops bytes
313K 214K 38.5K 2.16M 56.2K 8.36M 52.8K 19.7M 39.9G 18.8M 39.1G ufs
0 0 0 2.95K 0 3.81K 282 2.52K 466K 0 0 proc
0 0 0 0 0 0 0 0 0 0 0 nfs
10 8 2 86 9 98 15 413 103M 8.43K 1.05G zfs
13 14 4 98 16 125 10 1.01K 258M 15.9K 127M lofs
8.73K 3.29K 5.25K 55.3K 37 1.20M 44 37.9K 38.3M 47.2K 35.9M tmpfs
0 0 0 4.93K 0 0 0 1.08K 913K 0 0 mntfs
3 2 1 503 3 897 13 122 25.8K 128 272K nfs3
10 8 0 615 10 10.1K 18 61 45.6K 292 2.26M nfs4
Example 2 Displaying Naming Activity
The following example shows the naming activity for ufs, nfs, nfs3, nfs4, and tmpfs:
$ fsstat -n ufs nfs nfs3 nfs4 tmpfs
lookup creat remov link renam mkdir rmdir rddir symlnk rdlnk
3.57M 3.10K 586 6 24 115 100 30.2K 5 330K ufs
0 0 0 0 0 0 0 0 0 0 nfs
18.3K 3 5 0 0 0 0 1.03K 2 346 nfs3
535 0 0 0 0 0 0 46 0 4 nfs4
146 24 15 0 0 4 0 4 0 0 tmpfs
Example 3 Displaying Attribute Activity
The following example shows the attribute activity for the FS type ufs and the mounted file systems "/" and "/export/home" every three seconds for every third iteration:
# fsstat -a ufs / /export/home 3 3 getattr setattr getsec setsec 378K 91.9K 11.8K 0 ufs 367K 82.3K 11.6K 0 / 11.3K 9.6K 198 0 /export/home 4.97K 2.27K 163 0 ufs 3.94K 1.36K 162 0 / 1.03K 927 1 0 /export/home 2.30K 1.06K 73 0 ufs 1.95K 766 71 0 / 361 317 2 0 /export/home 2.33K 1.06K 78 0 ufs 1.64K 451 77 0 / 711 631 1 0 /export/home
Example 4 Displaying File Operation Statistics
The following example shows the statistics for each file operation for "/" (using the -f option):
$ fsstat -f /
Mountpoint: /
operation #ops bytes
open 8.54K
close 9.8K
read 43.6K 65.9M
write 1.57K 2.99M
ioctl 2.06K
setfl 4
getattr 40.3K
setattr 38
access 9.19K
lookup 203K
create 595
remove 56
link 0
rename 9
mkdir 19
rmdir 0
readdir 2.02K 2.27M
symlink 4
readlink 8.31K
fsync 199
inactive 2.96K
fid 0
rwlock 47.2K
rwunlock 47.2K
seek 29.1K
cmp 42.9K
frlock 4.45K
space 8
realvp 3.25K
getpage 104K
putpage 2.69K
map 13.2K
addmap 34.4K
delmap 33.4K
poll 287
dump 0
pathconf 54
pageio 0
dumpctl 0
dispose 23.8K
getsecattr 697
setsecattr 0
shrlock 0
vnevent 0
See environ(5) for descriptions of the following environment variables that affect the execution of fsstat: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, LC_TIME, and NLSPATH.
The following exit values are returned:
0
Successful completion.
1
A fatal error occurred. A fatal error could be a failed system call or another internal error.
2
Invalid command-line options were specified.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
CSI | Enabled |
Interface Stability | See below. |
The command-line options are Unstable. The human-readable output is not considered an interface.
date(1), time(2), attributes(5)
All display options (-a, -f, -i, -n, -v) are mutually exclusive. Entering more than one of these options will result in an error.
The fstype and path operands must appear after the option, but before the interval or count on the command line. For example, "fsstat -a fstype interval". Preference is given to fstype so that if a user wishes to see the statistics for a directory that has the same name as an fstype (for example, ufs), then the path must be specified unambiguously (for example, ./ufs). Similarly, in order to define a file with a numeric name (for example, "10") from an interval or count operand, the name should be prefixed accordingly (for example, ./10).
When an interval is used, headers repeat after more than 12 lines of statistics have been displayed and the set of lines to be displayed in the current interval have completed.
Statistics are not displayed for all pseudo-filesystems. The output displayed with the -F option shows which of the loaded filesystem types are supported.
Unbundled file systems may not be recognized by fsstat.
The command-line options are classified as Unstable and could change. The output is not considered to be an interface. The construction of higher level software tools depend on either the command-line options or the output of fsstat is not recommended.