hur.st's bl.aagh

BSD, Ruby, Rust, Rambling

ioztat

ZFS dataset IO statistics

[python] [zfs]

ioztat is to OpenZFS datasets what zpool-iostat(8) is to ZFS pools and vdevs.

Where zpool-iostat provides IO statistics for accesses to the lower level components that make up a ZFS filesystem — the devices that underpin it and the mirrored, striped, and parity-combined virtual devices these are part of — ioztat does so for the filesystems and virtual block devices layered on top.

ioztat grew from a relatively modest Python script written by a few Reddit users, with a few sorting options and not much else.

I added FreeBSD support to it, and then… well:

NAME
     ioztat – display logical I/O statistics for ZFS datasets

SYNOPSIS
     ioztat -V | --version
     ioztat -h | --help
     ioztat [-DeHINnoSxyz] [-c count] [-i interval] [-T u|d]
            [-s name|operations|reads|writes|throughput|nread|nwritten]
            [dataset ...] [interval [count]]

Yes, that is rather a lot of flags. Helpfully I also wrote a man page for it.

Here’s a quick demo, showing average per-second IO since bootup:

-% ioztat
                     operations    throughput
dataset              read  write   read  write
------------------  -----  -----  -----  -----
zroot
  ROOT
    default             6      0  41.3K  13.4K
  bastille              0      0      0      0
    backups             0      0      0      0
    cache               0      0      0      0
      13.0-RELEASE      0      0      0      0
      13.1-RELEASE      0      0      0    108

Sorted by operations:

-% ioztat -s operations
                                       operations    throughput
dataset                                read  write   read  write
------------------------------------  -----  -----  -----  -----
zroot/ROOT/default                        6      0  41.3K  13.4K
zroot/bastille/jails/freshbsd0/root       3      0  25.4K  2.89K
zroot/freshbsd/db/postgres                1      0  6.95K    833
zroot/freshbsd/db/elastic                 0      0    567    698
zroot/var/log                             0      0    506    132

Summing all child dataset statistics into their parents (-S), displaying values per report interval rather than per-second (-I), suppressing display of child datasets (-n), skipping the initial since-boot summary record (-y), displaying extended, extended statistics, and setting the reporting interval to ten seconds:

-% ioztat -SInyxx zroot 10
             operations    throughput      opsize       unlinks
dataset      read  write   read  write   read  write  queue   done
----------  -----  -----  -----  -----  -----  -----  -----  -----
zroot          35     19  50.0K  20.8K  1.43K  1.09K      2      2
----------  -----  -----  -----  -----  -----  -----  -----  -----
zroot          41      8   198K  17.3K  4.83K  2.16K      6      6
----------  -----  -----  -----  -----  -----  -----  -----  -----
zroot           1      4    330    352    330     88      1      1
----------  -----  -----  -----  -----  -----  -----  -----  -----
zroot          52      8   229K  34.4K  4.40K  4.30K      5      5

Other notable options include -o to overwrite earlier reports in the terminal so it can be used as something of an iotop-alike tool, -z to omit inactive datasets, and the -H and -e flags intended for use with scripting.

ioztat is available in the FreeBSD ports system under sysutils/py-ioztat.

Linux users are encouraged to do something with my ioztat-packages repository. I don’t use Linux, I’m not writing all this and making your packages for you.