Manual Pages
Table of Contents
filestats - collect file usage statistics
filestats [ ages ages] [ timetype {a,m,c,cr}] [ sizes sizes]
[ snapshot snapshot_name] [ style style] [ volume
volume_name]
The filestats utility provides a summary of file usage
within a volume. It must be used on a snapshot, and the
only required argument is the snapshot name. The volume
name defaults to "vol0" if not specified. If the volume you
are examining is named otherwise, specify the name explicitly.
The following options are supported.
ages ages
Specifies the breakdown of ages, as a set of commaseparated
time values. The values are in seconds, but
as a convenience you can add an H or D suffix to a
number to get hours and days. For example, "900,4H,7D"
would produce a breakdown with 4 categories - files
accessed in the last 15 minutes, files accessed in the
last four hours, files accessed in the last week, and
all other files.
expr expression
This lets you specify a boolean expression that will be
evaluated for each inode encountered, and if the
expression is true, then the inode will be selected and
included in the various breakdowns of file usage. The
expression can contain "variables", which are merely
the name of an inode attribute enclosed in curly
braces. For example, {size} is evaluated as the size
of the current inode. The valid inode attributes that
you can use in expressions are:
- tid
- The tree id (for qtrees).
- type
- The file type (numeric, currently).
- perm
- Permissions.
- flags
- Additional flags.
- nlink
- Count of hard links.
- uid
- User id (numeric) of file owner.
- gid
- Group id (numeric) of file owner.
- size
- Size in bytes.
- blkcnt
- Size in blocks.
- gen
- Generation number.
- atime
- Time of last read or write (in seconds).
- mtime
- Time of last write (in seconds).
- ctime
- Time of last size/status change (in
seconds).
- crtime
- Time file was created (in seconds).
- atimeage
- Age of last read or write (Now - atime).
- mtimeage
- Age of last write (Now - mtime).
- ctimeage
- Age of last size/status change (Now ctime).
- crtimeage
- Age of file creation (Now - crtime).
timetype timetype
This lets you specify the type of time that will be
used in the "age" comparison. Valid values for time_type
are
- a
- Access time
- m
- Modification time
- c
- Change time (last size/status change)
- cr
- Creation time
sizes sizes
Specifies the breakdown of sizes, as a comma-separated
set of size values. The values are in bytes, but as a
convenience you can add a K, M, or G suffix to a number
to get kilobytes, megabytes, and gigabytes. For example,
"500K,2M,1G" would produce a breakdown with 4
categories - files less than 500K, files less than 2
megabytes, files less than 1 gigabyte, and all other
files.
To produce a breakdown that includes all unique file sizes,
specify "*" for the sizes value.
style style
Controls the style of output - the possible value for
count are "readable" (the default), "table" (colonseparated
values suitable for processing by programs),
and "html".
1. Produce default file usage breakdowns for snapshot
hourly.1 of volume vol0.
filestats volume vol0 snapshot hourly.1
2. Produce file usage breakdowns by monthly age values:
filestats volume vol0 snapshot hourly.1 ages
"30D,60D,90D,120D,150D,180D"
3. Produce file usage breakdowns for inodes whose size is
less than 100000 bytes and whose access time is less
than a day old:
filestats volume vol0 snapshot hourly.1 expr
"{size}<100000&&{atimeage}<86400)"
3. Produce a breakdown of the total number of files
and their total size. You can control the set of
ages and sizes that get used for this breakdown,
with the "ages" and "sizes" arguments. The output
also contains a breakdown of file usage by user-id
and group-id.
filestats snapshot hourly.1 volume vol0
Currently, the expression-evaluating code does not do any
optimizations, so although you can use arithmetic expressions,
it is most efficient if you do not. Of course, it's
most efficient if you don't use any expression at all.
Table of Contents