home | help
BLOCKIO(8)		     System Manager's Manual		      BLOCKIO(8)

NAME
     blockio -- display block device activity as a map of the address space

SYNOPSIS
     blockio [-a] [-i interval] [-color mode] [-scale scale] [-thresholds list]
	     [-decay duration] [-trail duration] [-buckets n] [-half]
	     [-source backend] [device ...]
     blockio -l
     blockio -demo n
     blockio -once [-for duration] [-size WxH]

DESCRIPTION
     blockio  draws  what the disks are doing as a map: one pane per device, one
     cell per slice of the device's address space,  green  for	reads,	red  for
     writes  and  amber  for  TRIM.   Cell zero is LBA zero in the top left, and
     cells run left to right and top to bottom, so a whole device  fits  a  pane
     whatever its size.  A resilver or a scrub appears as a bright band sweeping
     across the map.

     blockio  must  run  as  root whatever it reads, or elevated on Windows.  On
     FreeBSD the data comes from DTrace's dtrace(1) io provider, so  the  DTrace
     modules must be loaded:

	   kldload dtraceall

     and  device  geometry comes from diskinfo(8).  On macOS the data comes from
     fs_usage(1) and the geometry from diskutil(8), neither of which needs  any-
     thing  turned off; see "MACOS".  On Windows the data comes from Event Trac-
     ing for Windows and the geometry from the disks themselves; see "WINDOWS".

     Named devices are watched, with or without a  /dev/  prefix.   On	Windows,
     \\.\PhysicalDrive1  and PhysicalDrive1 both name disk1.  Given no names and
     no -a, blockio offers a list of every whole disk, all of  them  preselected
     but  the  disk  images;  devices  without	media are left out.  The list is
     kern.disks filtered by what answers diskinfo(8) on FreeBSD, the whole disks
     diskutil(8) reports on macOS, and every \\.\PhysicalDriveN  with  media  on
     Windows, as diskN.

     The options are:

     -a 	       Watch every disk, without asking.

     -l 	       List the disks and exit.

     -i interval       Sampling interval.  The default is 100ms.

     -color mode       Color  depth:  auto  (the default), truecolor, 256, 16 or
		       off.  Truecolor gives the decay	a  continuous  gradient,
		       256  colors  a  five step ramp per command, 16 colors dim
		       and bright, and off draws the trail as a middle	dot  and
		       activity as block characters of rising density.	NO_COLOR
		       is honored.

     -scale scale      How a byte rate becomes a color.  auto, the default, mea-
		       sures  each  device  against  its  own busiest cell, so a
		       quiet disk still shows structure.  fixed measures against
		       -thresholds, so the same  color	always	means  the  same
		       rate.

     -thresholds list  Hot  and  cold  steps  for fixed, in bytes per second per
		       cell, ascending, comma separated, one to eight  of  them.
		       K,   M  and  G  suffixes  are  binary.	The  default  is
		       `64K,512K,4M,32M'.  A cell covers a  slice  of  a  device
		       rather than all of it, so useful thresholds are far below
		       the device's total throughput.

     -decay duration   Half-life of activity on the map.  The default is 500ms.

     -trail duration   Half-life  of the trail, the dim record of where the head
		       has been.  The default is 60s; `0' turns it off.

     -buckets n        How finely the kernel splits each device.  DTrace  aggre-
		       gates  each  I/O  into `offset * buckets / mediasize', so
		       this is the ceiling on how fine the map	can  be.   Zero,
		       the  default,  asks for about as many as the terminal can
		       draw.  The value is clamped  to	256  through  16384  and
		       fixed  for  the run: enlarging the window afterwards does
		       not make the map finer.

     -half	       Draw two rows of cells per terminal row, the top half  of
		       each  cell in the foreground color and the bottom half in
		       the background one.  On by default; it needs a background
		       color, so it is ignored with -color off.

     -columns n        How many panes go side by side.	Zero, the default,  puts
		       one  or two devices in a single column and anything above
		       that in two.  A count that would leave the panes too nar-
		       row to read is reduced, and one that would leave them too
		       short to draw anything is raised.

     -source backend   Where the I/O comes from: auto, dtrace, fsusage	or  etw.
		       auto is the only backend on FreeBSD, fsusage on macOS and
		       etw on Windows.

     -demo n	       Fabricate  n  devices and traffic instead of tracing any-
		       thing.  Needs neither root nor disks, and is the easy way
		       to look at the layouts and the color modes.

     -once	       Sample for a while, print one frame  to	standard  output
		       and exit, for scripting or for pasting into a report.

     -for duration     How long -once samples.	The default is 2s.

     -size WxH	       Frame size for -once.  The default is 100x30.

   The display
     Every  cell  carries  two	layers.   Activity  fades  with the half-life of
     -decay, so the bright part of the map is what the disk is doing now.  Under
     it a dimmer trail fades with the half-life of  -trail,  showing  where  the
     head has been.

     The  pane	header	names  the device, its size and its description, and the
     line below gives read, write and TRIM rates in  bytes  and  operations  per
     second, with the total moved since the map was last cleared.

     By  default  panes  go in one column for one or two devices and two columns
     above that, so three devices sit in the four pane layout, five in	the  six
     pane layout and seven in the eight pane layout.  -columns and the l key say
     how many go side by side instead.

   Keys
     space, p
	     Pause.  The map freezes; the source keeps running.
     c	     Clear the map and the totals.
     s	     Switch the color scale between auto and fixed.
     +, -    Double or halve the thresholds, switching to fixed.
     l	     Cycle  the  column  count:  automatic,  then one column up to four,
	     never more columns than there are devices.
     1 to 9  Show one device full screen; the same key returns.
     0, a    Show every device again.
     q, esc, ^C
	     Quit.

ENVIRONMENT
     BLOCKIO_CONFIG  Path of the configuration file, overriding the default.

     XDG_CONFIG_HOME
		     Base directory of the configuration file.

     NO_COLOR	     If set, the map is drawn without color.

FILES
     ~/.config/blockio/config  Defaults, one `option = value' per line, with `#'
			       comments.   The	 options   are	 color,   scale,
			       thresholds,  decay, trail, buckets, columns, half
			       and interval, each taking the same values as  the
			       flag  of that name.  Flags override the file, and
			       a bad line is a warning rather than an error.

     %AppData%\blockio\config  The same, on Windows.

EXAMPLES
     Watch both halves of a mirror while it resilvers, with colors that mean the
     same thing on both:

	   blockio -scale fixed -thresholds 1M,8M,32M,128M ada0 ada1

     Follow a scrub for a long time, keeping the trail so the swept region stays
     visible:

	   blockio -a -trail 10m

     Capture one frame for a report:

	   blockio -a -once -for 5s -size 120x40 > frame.txt

     Look at the eight pane layout on a machine with two disks:

	   blockio -demo 8 -color truecolor

MACOS
     System Integrity Protection hides every kernel probe, so io:::start matches
     nothing until SIP is relaxed  from  recoveryOS.   The  default  backend  is
     therefore	fs_usage(1),  which  reports  the kdebug events the buffer cache
     raises for every completed I/O: a block number in the whole disk's  address
     space and a byte count, which is all the map needs.

     An APFS volume's I/O is reported against the synthesized container it lives
     in, never the physical disk underneath, so disk0 sits dark while disk3 does
     the work.	-l lists both.

     macOS  synthesizes  a  device  for  every	APFS container and two for every
     mounted disk image, so one SSD and a handful of  Xcode  simulator	runtimes
     come  to  fourteen  entries.  The images are listed but start unselected in
     the picker; -a still watches every one of them.

     Neither backend sees TRIM: unmap does not travel through the buffer  cache,
     so the amber layer stays empty.

     -source dtrace is for a machine that has had SIP relaxed with

	   csrutil enable --without dtrace

     from  recoveryOS,	which on Apple silicon wants the security policy lowered
     to Reduced Security first.  macOS carries the Solaris io provider, so it is
     a different D program: args[0] is a translated bufinfo_t, the direction  is
     b_flags  &  B_READ,  the size is b_bcount and the position is b_blkno.  De-
     vices are keyed by  minor	number,  because  the  devinfo_t  translator  in
     /usr/lib/dtrace/io.d leaves dev_name and dev_statname as the literal "??".

WINDOWS
     The  data	comes from Event Tracing for Windows: the Microsoft-Windows-Ker-
     nel-Disk provider raises an event for every completed  disk  I/O  with  the
     disk number, the byte count and the byte offset from the start of the disk.
     blockio starts a real-time session named `blockio', enables the provider in
     it and reads the events in-process.

     Only  an elevated process may enable a kernel provider, so blockio must run
     from an Administrator terminal, or under the sudo of Windows 11  in  inline
     mode:

	   sudo config --enable normal

     -l and -demo need no elevation.

     Disks  are  named	disk0,	disk1 and so on, numbered as Disk Management and
     diskpart number them.  Geometry comes from IOCTL_DISK_GET_DRIVE_GEOMETRY_EX
     and the description from IOCTL_STORAGE_QUERY_PROPERTY.  A	mounted  VHD  is
     listed but starts unselected in the picker.

     The provider knows reads, writes and flushes and nothing else, so the amber
     layer stays empty.

     There  is	one  session: a second blockio takes it over from the first, and
     one that is killed leaves it running until the next start reclaims  it,  or
     until

	   logman stop blockio -ets

SEE ALSO
     dtrace(1),  fs_usage(1), systat(1), diskinfo(8), diskutil(8), gstat(8), io-
     stat(8), zpool(8)

     The scripts shipped beside blockio, iosnoop.d and iosum.d,  show  the  same
     data as text.

CAVEATS
     On  FreeBSD,  each  logical  I/O reaches the io provider twice, once at the
     GEOM layer and once at the disk layer.  blockio traces the disk layer only,
     so nothing is counted twice, but activity to a provider that never  reaches
     a	disk, such as a fully cached read, is not shown at all: this is a map of
     what the disks do, not of what the file system was asked for.

     The bucket count is fixed at startup, baked into the generated D script  or
     into  the	accumulator  that  folds  fs_usage(1)  lines  or ETW events into
     frames.  Resizing the terminal rearranges the panes but does not  make  the
     map finer; restart for that.

FreeBSD ports 15.quarterly     September 10, 2026		      BLOCKIO(8)

home | help