xref: /freebsd/sys/contrib/openzfs/man/man8/zpool-iostat.8 (revision da5137abdf463bb5fee85061958a14dd12bc043e)
1eda14cbcSMatt Macy.\"
2eda14cbcSMatt Macy.\" CDDL HEADER START
3eda14cbcSMatt Macy.\"
4eda14cbcSMatt Macy.\" The contents of this file are subject to the terms of the
5eda14cbcSMatt Macy.\" Common Development and Distribution License (the "License").
6eda14cbcSMatt Macy.\" You may not use this file except in compliance with the License.
7eda14cbcSMatt Macy.\"
8eda14cbcSMatt Macy.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9eda14cbcSMatt Macy.\" or http://www.opensolaris.org/os/licensing.
10eda14cbcSMatt Macy.\" See the License for the specific language governing permissions
11eda14cbcSMatt Macy.\" and limitations under the License.
12eda14cbcSMatt Macy.\"
13eda14cbcSMatt Macy.\" When distributing Covered Code, include this CDDL HEADER in each
14eda14cbcSMatt Macy.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15eda14cbcSMatt Macy.\" If applicable, add the following below this CDDL HEADER, with the
16eda14cbcSMatt Macy.\" fields enclosed by brackets "[]" replaced with your own identifying
17eda14cbcSMatt Macy.\" information: Portions Copyright [yyyy] [name of copyright owner]
18eda14cbcSMatt Macy.\"
19eda14cbcSMatt Macy.\" CDDL HEADER END
20eda14cbcSMatt Macy.\"
21eda14cbcSMatt Macy.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
22eda14cbcSMatt Macy.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
23eda14cbcSMatt Macy.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
24eda14cbcSMatt Macy.\" Copyright (c) 2017 Datto Inc.
25eda14cbcSMatt Macy.\" Copyright (c) 2018 George Melikov. All Rights Reserved.
26eda14cbcSMatt Macy.\" Copyright 2017 Nexenta Systems, Inc.
27eda14cbcSMatt Macy.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
28eda14cbcSMatt Macy.\"
29*da5137abSMartin Matuska.Dd March 16, 2022
30eda14cbcSMatt Macy.Dt ZPOOL-IOSTAT 8
31eda14cbcSMatt Macy.Os
3216038816SMartin Matuska.
33eda14cbcSMatt Macy.Sh NAME
347877fdebSMatt Macy.Nm zpool-iostat
3516038816SMartin Matuska.Nd display logical I/O statistics for ZFS storage pools
36eda14cbcSMatt Macy.Sh SYNOPSIS
377877fdebSMatt Macy.Nm zpool
38eda14cbcSMatt Macy.Cm iostat
39eda14cbcSMatt Macy.Op Oo Oo Fl c Ar SCRIPT Oc Oo Fl lq Oc Oc Ns | Ns Fl rw
40eda14cbcSMatt Macy.Op Fl T Sy u Ns | Ns Sy d
41eda14cbcSMatt Macy.Op Fl ghHLnpPvy
4216038816SMartin Matuska.Oo Ar pool Ns … Ns | Ns Oo Ar pool vdev Ns … Oc Ns | Ns Ar vdev Ns … Oc
43eda14cbcSMatt Macy.Op Ar interval Op Ar count
4416038816SMartin Matuska.
45eda14cbcSMatt Macy.Sh DESCRIPTION
4616038816SMartin MatuskaDisplays logical I/O statistics for the given pools/vdevs.
4716038816SMartin MatuskaPhysical I/O statistics may be observed via
48eda14cbcSMatt Macy.Xr iostat 1 .
49eda14cbcSMatt MacyIf writes are located nearby, they may be merged into a single
5016038816SMartin Matuskalarger operation.
5116038816SMartin MatuskaAdditional I/O may be generated depending on the level of vdev redundancy.
52eda14cbcSMatt MacyTo filter output, you may pass in a list of pools, a pool and list of vdevs
5316038816SMartin Matuskain that pool, or a list of any vdevs from any pool.
5416038816SMartin MatuskaIf no items are specified, statistics for every pool in the system are shown.
55eda14cbcSMatt MacyWhen given an
56eda14cbcSMatt Macy.Ar interval ,
57eda14cbcSMatt Macythe statistics are printed every
58eda14cbcSMatt Macy.Ar interval
5916038816SMartin Matuskaseconds until killed.
6016038816SMartin MatuskaIf
61eda14cbcSMatt Macy.Fl n
62eda14cbcSMatt Macyflag is specified the headers are displayed only once, otherwise they are
6316038816SMartin Matuskadisplayed periodically.
6416038816SMartin MatuskaIf
6516038816SMartin Matuska.Ar count
6616038816SMartin Matuskais specified, the command exits after
6716038816SMartin Matuska.Ar count
6816038816SMartin Matuskareports are printed.
6916038816SMartin MatuskaThe first report printed is always the statistics since boot regardless of whether
70eda14cbcSMatt Macy.Ar interval
71eda14cbcSMatt Macyand
72eda14cbcSMatt Macy.Ar count
7316038816SMartin Matuskaare passed.
7416038816SMartin MatuskaHowever, this behavior can be suppressed with the
75eda14cbcSMatt Macy.Fl y
7616038816SMartin Matuskaflag.
7716038816SMartin MatuskaAlso note that the units of
78eda14cbcSMatt Macy.Sy K ,
79eda14cbcSMatt Macy.Sy M ,
8016038816SMartin Matuska.Sy G Ns …
8116038816SMartin Matuskathat are printed in the report are in base 1024.
8216038816SMartin MatuskaTo get the raw values, use the
83eda14cbcSMatt Macy.Fl p
84eda14cbcSMatt Macyflag.
85eda14cbcSMatt Macy.Bl -tag -width Ds
8616038816SMartin Matuska.It Fl c Op Ar SCRIPT1 Ns Oo , Ns Ar SCRIPT2 Oc Ns …
87eda14cbcSMatt MacyRun a script (or scripts) on each vdev and include the output as a new column
88eda14cbcSMatt Macyin the
89eda14cbcSMatt Macy.Nm zpool Cm iostat
9016038816SMartin Matuskaoutput.
9116038816SMartin MatuskaUsers can run any script found in their
92eda14cbcSMatt Macy.Pa ~/.zpool.d
93eda14cbcSMatt Macydirectory or from the system
94eda14cbcSMatt Macy.Pa /etc/zfs/zpool.d
9516038816SMartin Matuskadirectory.
9616038816SMartin MatuskaScript names containing the slash
9716038816SMartin Matuska.Pq Sy /
9816038816SMartin Matuskacharacter are not allowed.
99eda14cbcSMatt MacyThe default search path can be overridden by setting the
10016038816SMartin Matuska.Sy ZPOOL_SCRIPTS_PATH
10116038816SMartin Matuskaenvironment variable.
10216038816SMartin MatuskaA privileged user can only run
103eda14cbcSMatt Macy.Fl c
10416038816SMartin Matuskaif they have the
10516038816SMartin Matuska.Sy ZPOOL_SCRIPTS_AS_ROOT
10616038816SMartin Matuskaenvironment variable set.
10716038816SMartin MatuskaIf a script requires the use of a privileged command, like
108eda14cbcSMatt Macy.Xr smartctl 8 ,
109eda14cbcSMatt Macythen it's recommended you allow the user access to it in
110eda14cbcSMatt Macy.Pa /etc/sudoers
111eda14cbcSMatt Macyor add the user to the
112eda14cbcSMatt Macy.Pa /etc/sudoers.d/zfs
113eda14cbcSMatt Macyfile.
114eda14cbcSMatt Macy.Pp
115eda14cbcSMatt MacyIf
116eda14cbcSMatt Macy.Fl c
117eda14cbcSMatt Macyis passed without a script name, it prints a list of all scripts.
118eda14cbcSMatt Macy.Fl c
119eda14cbcSMatt Macyalso sets verbose mode
120eda14cbcSMatt Macy.No \&( Ns Fl v Ns No \&).
121eda14cbcSMatt Macy.Pp
12216038816SMartin MatuskaScript output should be in the form of "name=value".
12316038816SMartin MatuskaThe column name is set to "name" and the value is set to "value".
12416038816SMartin MatuskaMultiple lines can be used to output multiple columns.
12516038816SMartin MatuskaThe first line of output not in the
12616038816SMartin Matuska"name=value" format is displayed without a column title,
12716038816SMartin Matuskaand no more output after that is displayed.
12816038816SMartin MatuskaThis can be useful for printing error messages.
12916038816SMartin MatuskaBlank or NULL values are printed as a '-' to make output AWKable.
130eda14cbcSMatt Macy.Pp
131eda14cbcSMatt MacyThe following environment variables are set before running each script:
13216038816SMartin Matuska.Bl -tag -compact -width "VDEV_ENC_SYSFS_PATH"
133eda14cbcSMatt Macy.It Sy VDEV_PATH
134eda14cbcSMatt MacyFull path to the vdev
135eda14cbcSMatt Macy.It Sy VDEV_UPATH
13616038816SMartin MatuskaUnderlying path to the vdev
13716038816SMartin Matuska.Pq Pa /dev/sd* .
13816038816SMartin MatuskaFor use with device mapper, multipath, or partitioned vdevs.
139eda14cbcSMatt Macy.It Sy VDEV_ENC_SYSFS_PATH
140eda14cbcSMatt MacyThe sysfs path to the enclosure for the vdev (if any).
141eda14cbcSMatt Macy.El
142eda14cbcSMatt Macy.It Fl T Sy u Ns | Ns Sy d
143eda14cbcSMatt MacyDisplay a time stamp.
144eda14cbcSMatt MacySpecify
145eda14cbcSMatt Macy.Sy u
146eda14cbcSMatt Macyfor a printed representation of the internal representation of time.
147eda14cbcSMatt MacySee
148eda14cbcSMatt Macy.Xr time 2 .
149eda14cbcSMatt MacySpecify
150eda14cbcSMatt Macy.Sy d
151eda14cbcSMatt Macyfor standard date format.
152eda14cbcSMatt MacySee
153eda14cbcSMatt Macy.Xr date 1 .
154eda14cbcSMatt Macy.It Fl g
15516038816SMartin MatuskaDisplay vdev GUIDs instead of the normal device names.
15616038816SMartin MatuskaThese GUIDs can be used in place of device names for the zpool
157eda14cbcSMatt Macydetach/offline/remove/replace commands.
158eda14cbcSMatt Macy.It Fl H
15916038816SMartin MatuskaScripted mode.
16016038816SMartin MatuskaDo not display headers, and separate fields by a
161eda14cbcSMatt Macysingle tab instead of arbitrary space.
162eda14cbcSMatt Macy.It Fl L
16316038816SMartin MatuskaDisplay real paths for vdevs resolving all symbolic links.
16416038816SMartin MatuskaThis can be used to look up the current block device name regardless of the
165eda14cbcSMatt Macy.Pa /dev/disk/
166eda14cbcSMatt Macypath used to open it.
167eda14cbcSMatt Macy.It Fl n
168eda14cbcSMatt MacyPrint headers only once when passed
169eda14cbcSMatt Macy.It Fl p
17016038816SMartin MatuskaDisplay numbers in parsable (exact) values.
17116038816SMartin MatuskaTime values are in nanoseconds.
172eda14cbcSMatt Macy.It Fl P
17316038816SMartin MatuskaDisplay full paths for vdevs instead of only the last component of the path.
17416038816SMartin MatuskaThis can be used in conjunction with the
175eda14cbcSMatt Macy.Fl L
176eda14cbcSMatt Macyflag.
177eda14cbcSMatt Macy.It Fl r
17816038816SMartin MatuskaPrint request size histograms for the leaf vdev's I/O.
17916038816SMartin MatuskaThis includes histograms of individual I/O (ind) and aggregate I/O (agg).
18016038816SMartin MatuskaThese stats can be useful for observing how well I/O aggregation is working.
18116038816SMartin MatuskaNote that TRIM I/O may exceed 16M, but will be counted as 16M.
182eda14cbcSMatt Macy.It Fl v
183eda14cbcSMatt MacyVerbose statistics Reports usage statistics for individual vdevs within the
184eda14cbcSMatt Macypool, in addition to the pool-wide statistics.
185eda14cbcSMatt Macy.It Fl y
18616038816SMartin MatuskaNormally the first line of output reports the statistics since boot:
18716038816SMartin Matuskasuppress it.
188eda14cbcSMatt Macy.It Fl w
189eda14cbcSMatt MacyDisplay latency histograms:
19016038816SMartin Matuska.Bl -tag -compact -width "asyncq_read/write"
19116038816SMartin Matuska.It Sy total_wait
19216038816SMartin MatuskaTotal I/O time (queuing + disk I/O time).
19316038816SMartin Matuska.It Sy disk_wait
19416038816SMartin MatuskaDisk I/O time (time reading/writing the disk).
19516038816SMartin Matuska.It Sy syncq_wait
19616038816SMartin MatuskaAmount of time I/O spent in synchronous priority queues.
19716038816SMartin MatuskaDoes not include disk time.
19816038816SMartin Matuska.It Sy asyncq_wait
19916038816SMartin MatuskaAmount of time I/O spent in asynchronous priority queues.
20016038816SMartin MatuskaDoes not include disk time.
20116038816SMartin Matuska.It Sy scrub
20216038816SMartin MatuskaAmount of time I/O spent in scrub queue.
20316038816SMartin MatuskaDoes not include disk time.
20421b492edSMartin Matuska.It Sy rebuild
20521b492edSMartin MatuskaAmount of time I/O spent in rebuild queue.
20621b492edSMartin MatuskaDoes not include disk time.
20716038816SMartin Matuska.El
208eda14cbcSMatt Macy.It Fl l
209eda14cbcSMatt MacyInclude average latency statistics:
21016038816SMartin Matuska.Bl -tag -compact -width "asyncq_read/write"
21116038816SMartin Matuska.It Sy total_wait
21216038816SMartin MatuskaAverage total I/O time (queuing + disk I/O time).
21316038816SMartin Matuska.It Sy disk_wait
21416038816SMartin MatuskaAverage disk I/O time (time reading/writing the disk).
21516038816SMartin Matuska.It Sy syncq_wait
21616038816SMartin MatuskaAverage amount of time I/O spent in synchronous priority queues.
217eda14cbcSMatt MacyDoes not include disk time.
21816038816SMartin Matuska.It Sy asyncq_wait
21916038816SMartin MatuskaAverage amount of time I/O spent in asynchronous priority queues.
22016038816SMartin MatuskaDoes not include disk time.
22116038816SMartin Matuska.It Sy scrub
22216038816SMartin MatuskaAverage queuing time in scrub queue.
22316038816SMartin MatuskaDoes not include disk time.
22416038816SMartin Matuska.It Sy trim
22516038816SMartin MatuskaAverage queuing time in trim queue.
22616038816SMartin MatuskaDoes not include disk time.
22721b492edSMartin Matuska.It Sy rebuild
22821b492edSMartin MatuskaAverage queuing time in rebuild queue.
22921b492edSMartin MatuskaDoes not include disk time.
23016038816SMartin Matuska.El
231eda14cbcSMatt Macy.It Fl q
23216038816SMartin MatuskaInclude active queue statistics.
23316038816SMartin MatuskaEach priority queue has both pending
23416038816SMartin Matuska.Sy ( pend )
23516038816SMartin Matuskaand active
23616038816SMartin Matuska.Sy ( activ )
23716038816SMartin MatuskaI/O requests.
23816038816SMartin MatuskaPending requests are waiting to be issued to the disk,
23916038816SMartin Matuskaand active requests have been issued to disk and are waiting for completion.
24016038816SMartin MatuskaThese stats are broken out by priority queue:
24116038816SMartin Matuska.Bl -tag -compact -width "asyncq_read/write"
24216038816SMartin Matuska.It Sy syncq_read/write
243eda14cbcSMatt MacyCurrent number of entries in synchronous priority
244eda14cbcSMatt Macyqueues.
24516038816SMartin Matuska.It Sy asyncq_read/write
246eda14cbcSMatt MacyCurrent number of entries in asynchronous priority queues.
24716038816SMartin Matuska.It Sy scrubq_read
248eda14cbcSMatt MacyCurrent number of entries in scrub queue.
24916038816SMartin Matuska.It Sy trimq_write
250eda14cbcSMatt MacyCurrent number of entries in trim queue.
25121b492edSMartin Matuska.It Sy rebuildq_write
25221b492edSMartin MatuskaCurrent number of entries in rebuild queue.
25316038816SMartin Matuska.El
254eda14cbcSMatt Macy.Pp
255eda14cbcSMatt MacyAll queue statistics are instantaneous measurements of the number of
25616038816SMartin Matuskaentries in the queues.
25716038816SMartin MatuskaIf you specify an interval,
25816038816SMartin Matuskathe measurements will be sampled from the end of the interval.
259eda14cbcSMatt Macy.El
26016038816SMartin Matuska.
261*da5137abSMartin Matuska.Sh EXAMPLES
262*da5137abSMartin Matuska.\" These are, respectively, examples 13, 16 from zpool.8
263*da5137abSMartin Matuska.\" Make sure to update them bidirectionally
264*da5137abSMartin Matuska.Ss Example 13 : No Adding Cache Devices to a ZFS Pool
265*da5137abSMartin MatuskaThe following command adds two disks for use as cache devices to a ZFS storage
266*da5137abSMartin Matuskapool:
267*da5137abSMartin Matuska.Dl # Nm zpool Cm add Ar pool Sy cache Pa sdc sdd
268*da5137abSMartin Matuska.Pp
269*da5137abSMartin MatuskaOnce added, the cache devices gradually fill with content from main memory.
270*da5137abSMartin MatuskaDepending on the size of your cache devices, it could take over an hour for
271*da5137abSMartin Matuskathem to fill.
272*da5137abSMartin MatuskaCapacity and reads can be monitored using the
273*da5137abSMartin Matuska.Cm iostat
274*da5137abSMartin Matuskasubcommand as follows:
275*da5137abSMartin Matuska.Dl # Nm zpool Cm iostat Fl v Ar pool 5
276*da5137abSMartin Matuska.
277*da5137abSMartin Matuska.Ss Example 16 : No Adding output columns
278*da5137abSMartin MatuskaAdditional columns can be added to the
279*da5137abSMartin Matuska.Nm zpool Cm status No and Nm zpool Cm iostat No output with Fl c .
280*da5137abSMartin Matuska.Bd -literal -compact -offset Ds
281*da5137abSMartin Matuska.No # Nm zpool Cm status Fl c Pa vendor , Ns Pa model , Ns Pa size
282*da5137abSMartin Matuska   NAME     STATE  READ WRITE CKSUM vendor  model        size
283*da5137abSMartin Matuska   tank     ONLINE 0    0     0
284*da5137abSMartin Matuska   mirror-0 ONLINE 0    0     0
285*da5137abSMartin Matuska   U1       ONLINE 0    0     0     SEAGATE ST8000NM0075 7.3T
286*da5137abSMartin Matuska   U10      ONLINE 0    0     0     SEAGATE ST8000NM0075 7.3T
287*da5137abSMartin Matuska   U11      ONLINE 0    0     0     SEAGATE ST8000NM0075 7.3T
288*da5137abSMartin Matuska   U12      ONLINE 0    0     0     SEAGATE ST8000NM0075 7.3T
289*da5137abSMartin Matuska   U13      ONLINE 0    0     0     SEAGATE ST8000NM0075 7.3T
290*da5137abSMartin Matuska   U14      ONLINE 0    0     0     SEAGATE ST8000NM0075 7.3T
291*da5137abSMartin Matuska
292*da5137abSMartin Matuska.No # Nm zpool Cm iostat Fl vc Pa size
293*da5137abSMartin Matuska              capacity     operations     bandwidth
294*da5137abSMartin Matuskapool        alloc   free   read  write   read  write  size
295*da5137abSMartin Matuska----------  -----  -----  -----  -----  -----  -----  ----
296*da5137abSMartin Matuskarpool       14.6G  54.9G      4     55   250K  2.69M
297*da5137abSMartin Matuska  sda1      14.6G  54.9G      4     55   250K  2.69M   70G
298*da5137abSMartin Matuska----------  -----  -----  -----  -----  -----  -----  ----
299*da5137abSMartin Matuska.Ed
300*da5137abSMartin Matuska.
301eda14cbcSMatt Macy.Sh SEE ALSO
302eda14cbcSMatt Macy.Xr iostat 1 ,
30316038816SMartin Matuska.Xr smartctl 8 ,
30416038816SMartin Matuska.Xr zpool-list 8 ,
30516038816SMartin Matuska.Xr zpool-status 8
306