1.\"
2.\" CDDL HEADER START
3.\"
4.\" The contents of this file are subject to the terms of the
5.\" Common Development and Distribution License (the "License").
6.\" You may not use this file except in compliance with the License.
7.\"
8.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9.\" or http://www.opensolaris.org/os/licensing.
10.\" See the License for the specific language governing permissions
11.\" and limitations under the License.
12.\"
13.\" When distributing Covered Code, include this CDDL HEADER in each
14.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15.\" If applicable, add the following below this CDDL HEADER, with the
16.\" fields enclosed by brackets "[]" replaced with your own identifying
17.\" information: Portions Copyright [yyyy] [name of copyright owner]
18.\"
19.\" CDDL HEADER END
20.\"
21.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
22.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
23.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
24.\" Copyright (c) 2017 Datto Inc.
25.\" Copyright (c) 2018 George Melikov. All Rights Reserved.
26.\" Copyright 2017 Nexenta Systems, Inc.
27.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
28.\"
29.Dd May 27, 2021
30.Dt ZPOOL-IOSTAT 8
31.Os
32.
33.Sh NAME
34.Nm zpool-iostat
35.Nd display logical I/O statistics for ZFS storage pools
36.Sh SYNOPSIS
37.Nm zpool
38.Cm iostat
39.Op Oo Oo Fl c Ar SCRIPT Oc Oo Fl lq Oc Oc Ns | Ns Fl rw
40.Op Fl T Sy u Ns | Ns Sy d
41.Op Fl ghHLnpPvy
42.Oo Ar pool Ns … Ns | Ns Oo Ar pool vdev Ns … Oc Ns | Ns Ar vdev Ns … Oc
43.Op Ar interval Op Ar count
44.
45.Sh DESCRIPTION
46Displays logical I/O statistics for the given pools/vdevs.
47Physical I/O statistics may be observed via
48.Xr iostat 1 .
49If writes are located nearby, they may be merged into a single
50larger operation.
51Additional I/O may be generated depending on the level of vdev redundancy.
52To filter output, you may pass in a list of pools, a pool and list of vdevs
53in that pool, or a list of any vdevs from any pool.
54If no items are specified, statistics for every pool in the system are shown.
55When given an
56.Ar interval ,
57the statistics are printed every
58.Ar interval
59seconds until killed.
60If
61.Fl n
62flag is specified the headers are displayed only once, otherwise they are
63displayed periodically.
64If
65.Ar count
66is specified, the command exits after
67.Ar count
68reports are printed.
69The first report printed is always the statistics since boot regardless of whether
70.Ar interval
71and
72.Ar count
73are passed.
74However, this behavior can be suppressed with the
75.Fl y
76flag.
77Also note that the units of
78.Sy K ,
79.Sy M ,
80.Sy G Ns …
81that are printed in the report are in base 1024.
82To get the raw values, use the
83.Fl p
84flag.
85.Bl -tag -width Ds
86.It Fl c Op Ar SCRIPT1 Ns Oo , Ns Ar SCRIPT2 Oc Ns …
87Run a script (or scripts) on each vdev and include the output as a new column
88in the
89.Nm zpool Cm iostat
90output.
91Users can run any script found in their
92.Pa ~/.zpool.d
93directory or from the system
94.Pa /etc/zfs/zpool.d
95directory.
96Script names containing the slash
97.Pq Sy /
98character are not allowed.
99The default search path can be overridden by setting the
100.Sy ZPOOL_SCRIPTS_PATH
101environment variable.
102A privileged user can only run
103.Fl c
104if they have the
105.Sy ZPOOL_SCRIPTS_AS_ROOT
106environment variable set.
107If a script requires the use of a privileged command, like
108.Xr smartctl 8 ,
109then it's recommended you allow the user access to it in
110.Pa /etc/sudoers
111or add the user to the
112.Pa /etc/sudoers.d/zfs
113file.
114.Pp
115If
116.Fl c
117is passed without a script name, it prints a list of all scripts.
118.Fl c
119also sets verbose mode
120.No \&( Ns Fl v Ns No \&).
121.Pp
122Script output should be in the form of "name=value".
123The column name is set to "name" and the value is set to "value".
124Multiple lines can be used to output multiple columns.
125The first line of output not in the
126"name=value" format is displayed without a column title,
127and no more output after that is displayed.
128This can be useful for printing error messages.
129Blank or NULL values are printed as a '-' to make output AWKable.
130.Pp
131The following environment variables are set before running each script:
132.Bl -tag -compact -width "VDEV_ENC_SYSFS_PATH"
133.It Sy VDEV_PATH
134Full path to the vdev
135.It Sy VDEV_UPATH
136Underlying path to the vdev
137.Pq Pa /dev/sd* .
138For use with device mapper, multipath, or partitioned vdevs.
139.It Sy VDEV_ENC_SYSFS_PATH
140The sysfs path to the enclosure for the vdev (if any).
141.El
142.It Fl T Sy u Ns | Ns Sy d
143Display a time stamp.
144Specify
145.Sy u
146for a printed representation of the internal representation of time.
147See
148.Xr time 2 .
149Specify
150.Sy d
151for standard date format.
152See
153.Xr date 1 .
154.It Fl g
155Display vdev GUIDs instead of the normal device names.
156These GUIDs can be used in place of device names for the zpool
157detach/offline/remove/replace commands.
158.It Fl H
159Scripted mode.
160Do not display headers, and separate fields by a
161single tab instead of arbitrary space.
162.It Fl L
163Display real paths for vdevs resolving all symbolic links.
164This can be used to look up the current block device name regardless of the
165.Pa /dev/disk/
166path used to open it.
167.It Fl n
168Print headers only once when passed
169.It Fl p
170Display numbers in parsable (exact) values.
171Time values are in nanoseconds.
172.It Fl P
173Display full paths for vdevs instead of only the last component of the path.
174This can be used in conjunction with the
175.Fl L
176flag.
177.It Fl r
178Print request size histograms for the leaf vdev's I/O.
179This includes histograms of individual I/O (ind) and aggregate I/O (agg).
180These stats can be useful for observing how well I/O aggregation is working.
181Note that TRIM I/O may exceed 16M, but will be counted as 16M.
182.It Fl v
183Verbose statistics Reports usage statistics for individual vdevs within the
184pool, in addition to the pool-wide statistics.
185.It Fl y
186Normally the first line of output reports the statistics since boot:
187suppress it.
188.It Fl w
189Display latency histograms:
190.Bl -tag -compact -width "asyncq_read/write"
191.It Sy total_wait
192Total I/O time (queuing + disk I/O time).
193.It Sy disk_wait
194Disk I/O time (time reading/writing the disk).
195.It Sy syncq_wait
196Amount of time I/O spent in synchronous priority queues.
197Does not include disk time.
198.It Sy asyncq_wait
199Amount of time I/O spent in asynchronous priority queues.
200Does not include disk time.
201.It Sy scrub
202Amount of time I/O spent in scrub queue.
203Does not include disk time.
204.It Sy rebuild
205Amount of time I/O spent in rebuild queue.
206Does not include disk time.
207.El
208.It Fl l
209Include average latency statistics:
210.Bl -tag -compact -width "asyncq_read/write"
211.It Sy total_wait
212Average total I/O time (queuing + disk I/O time).
213.It Sy disk_wait
214Average disk I/O time (time reading/writing the disk).
215.It Sy syncq_wait
216Average amount of time I/O spent in synchronous priority queues.
217Does not include disk time.
218.It Sy asyncq_wait
219Average amount of time I/O spent in asynchronous priority queues.
220Does not include disk time.
221.It Sy scrub
222Average queuing time in scrub queue.
223Does not include disk time.
224.It Sy trim
225Average queuing time in trim queue.
226Does not include disk time.
227.It Sy rebuild
228Average queuing time in rebuild queue.
229Does not include disk time.
230.El
231.It Fl q
232Include active queue statistics.
233Each priority queue has both pending
234.Sy ( pend )
235and active
236.Sy ( activ )
237I/O requests.
238Pending requests are waiting to be issued to the disk,
239and active requests have been issued to disk and are waiting for completion.
240These stats are broken out by priority queue:
241.Bl -tag -compact -width "asyncq_read/write"
242.It Sy syncq_read/write
243Current number of entries in synchronous priority
244queues.
245.It Sy asyncq_read/write
246Current number of entries in asynchronous priority queues.
247.It Sy scrubq_read
248Current number of entries in scrub queue.
249.It Sy trimq_write
250Current number of entries in trim queue.
251.It Sy rebuildq_write
252Current number of entries in rebuild queue.
253.El
254.Pp
255All queue statistics are instantaneous measurements of the number of
256entries in the queues.
257If you specify an interval,
258the measurements will be sampled from the end of the interval.
259.El
260.
261.Sh SEE ALSO
262.Xr iostat 1 ,
263.Xr smartctl 8 ,
264.Xr zpool-list 8 ,
265.Xr zpool-status 8
266