xref: /freebsd/sys/contrib/openzfs/man/man8/zpool-iostat.8 (revision fd45b686f9d92f583366c75b22c04c7ee49709c0)
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
9271171e0SMartin Matuska.\" or https://opensource.org/licenses/CDDL-1.0.
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.\"
29da5137abSMartin 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.
69bb2d13b6SMartin MatuskaThe first report printed is always the statistics since boot regardless of
70bb2d13b6SMartin Matuskawhether
71eda14cbcSMatt Macy.Ar interval
72eda14cbcSMatt Macyand
73eda14cbcSMatt Macy.Ar count
7416038816SMartin Matuskaare passed.
7516038816SMartin MatuskaHowever, this behavior can be suppressed with the
76eda14cbcSMatt Macy.Fl y
7716038816SMartin Matuskaflag.
7816038816SMartin MatuskaAlso note that the units of
79eda14cbcSMatt Macy.Sy K ,
80eda14cbcSMatt Macy.Sy M ,
8116038816SMartin Matuska.Sy G Ns …
8216038816SMartin Matuskathat are printed in the report are in base 1024.
8316038816SMartin MatuskaTo get the raw values, use the
84eda14cbcSMatt Macy.Fl p
85eda14cbcSMatt Macyflag.
86eda14cbcSMatt Macy.Bl -tag -width Ds
8716038816SMartin Matuska.It Fl c Op Ar SCRIPT1 Ns Oo , Ns Ar SCRIPT2 Oc Ns …
88eda14cbcSMatt MacyRun a script (or scripts) on each vdev and include the output as a new column
89eda14cbcSMatt Macyin the
90eda14cbcSMatt Macy.Nm zpool Cm iostat
9116038816SMartin Matuskaoutput.
9216038816SMartin MatuskaUsers can run any script found in their
93eda14cbcSMatt Macy.Pa ~/.zpool.d
94eda14cbcSMatt Macydirectory or from the system
95eda14cbcSMatt Macy.Pa /etc/zfs/zpool.d
9616038816SMartin Matuskadirectory.
9716038816SMartin MatuskaScript names containing the slash
9816038816SMartin Matuska.Pq Sy /
9916038816SMartin Matuskacharacter are not allowed.
100eda14cbcSMatt MacyThe default search path can be overridden by setting the
10116038816SMartin Matuska.Sy ZPOOL_SCRIPTS_PATH
10216038816SMartin Matuskaenvironment variable.
10316038816SMartin MatuskaA privileged user can only run
104eda14cbcSMatt Macy.Fl c
10516038816SMartin Matuskaif they have the
10616038816SMartin Matuska.Sy ZPOOL_SCRIPTS_AS_ROOT
10716038816SMartin Matuskaenvironment variable set.
10816038816SMartin MatuskaIf a script requires the use of a privileged command, like
109eda14cbcSMatt Macy.Xr smartctl 8 ,
110eda14cbcSMatt Macythen it's recommended you allow the user access to it in
111eda14cbcSMatt Macy.Pa /etc/sudoers
112eda14cbcSMatt Macyor add the user to the
113eda14cbcSMatt Macy.Pa /etc/sudoers.d/zfs
114eda14cbcSMatt Macyfile.
115eda14cbcSMatt Macy.Pp
116eda14cbcSMatt MacyIf
117eda14cbcSMatt Macy.Fl c
118eda14cbcSMatt Macyis passed without a script name, it prints a list of all scripts.
119eda14cbcSMatt Macy.Fl c
120eda14cbcSMatt Macyalso sets verbose mode
121eda14cbcSMatt Macy.No \&( Ns Fl v Ns No \&) .
122eda14cbcSMatt Macy.Pp
12316038816SMartin MatuskaScript output should be in the form of "name=value".
12416038816SMartin MatuskaThe column name is set to "name" and the value is set to "value".
12516038816SMartin MatuskaMultiple lines can be used to output multiple columns.
12616038816SMartin MatuskaThe first line of output not in the
12716038816SMartin Matuska"name=value" format is displayed without a column title,
12816038816SMartin Matuskaand no more output after that is displayed.
12916038816SMartin MatuskaThis can be useful for printing error messages.
13016038816SMartin MatuskaBlank or NULL values are printed as a '-' to make output AWKable.
131eda14cbcSMatt Macy.Pp
132eda14cbcSMatt MacyThe following environment variables are set before running each script:
13316038816SMartin Matuska.Bl -tag -compact -width "VDEV_ENC_SYSFS_PATH"
134eda14cbcSMatt Macy.It Sy VDEV_PATH
135eda14cbcSMatt MacyFull path to the vdev
136eda14cbcSMatt Macy.It Sy VDEV_UPATH
13716038816SMartin MatuskaUnderlying path to the vdev
13816038816SMartin Matuska.Pq Pa /dev/sd* .
13916038816SMartin MatuskaFor use with device mapper, multipath, or partitioned vdevs.
140eda14cbcSMatt Macy.It Sy VDEV_ENC_SYSFS_PATH
141eda14cbcSMatt MacyThe sysfs path to the enclosure for the vdev (if any).
142eda14cbcSMatt Macy.El
143eda14cbcSMatt Macy.It Fl T Sy u Ns | Ns Sy d
144eda14cbcSMatt MacyDisplay a time stamp.
145eda14cbcSMatt MacySpecify
146eda14cbcSMatt Macy.Sy u
147eda14cbcSMatt Macyfor a printed representation of the internal representation of time.
148eda14cbcSMatt MacySee
149*fd45b686SMartin Matuska.Xr time 1 .
150eda14cbcSMatt MacySpecify
151eda14cbcSMatt Macy.Sy d
152eda14cbcSMatt Macyfor standard date format.
153eda14cbcSMatt MacySee
154eda14cbcSMatt Macy.Xr date 1 .
155eda14cbcSMatt Macy.It Fl g
15616038816SMartin MatuskaDisplay vdev GUIDs instead of the normal device names.
15716038816SMartin MatuskaThese GUIDs can be used in place of device names for the zpool
158eda14cbcSMatt Macydetach/offline/remove/replace commands.
159eda14cbcSMatt Macy.It Fl H
16016038816SMartin MatuskaScripted mode.
16116038816SMartin MatuskaDo not display headers, and separate fields by a
162eda14cbcSMatt Macysingle tab instead of arbitrary space.
163eda14cbcSMatt Macy.It Fl L
16416038816SMartin MatuskaDisplay real paths for vdevs resolving all symbolic links.
16516038816SMartin MatuskaThis can be used to look up the current block device name regardless of the
166eda14cbcSMatt Macy.Pa /dev/disk/
167eda14cbcSMatt Macypath used to open it.
168eda14cbcSMatt Macy.It Fl n
169eda14cbcSMatt MacyPrint headers only once when passed
170eda14cbcSMatt Macy.It Fl p
17116038816SMartin MatuskaDisplay numbers in parsable (exact) values.
17216038816SMartin MatuskaTime values are in nanoseconds.
173eda14cbcSMatt Macy.It Fl P
17416038816SMartin MatuskaDisplay full paths for vdevs instead of only the last component of the path.
17516038816SMartin MatuskaThis can be used in conjunction with the
176eda14cbcSMatt Macy.Fl L
177eda14cbcSMatt Macyflag.
178eda14cbcSMatt Macy.It Fl r
17916038816SMartin MatuskaPrint request size histograms for the leaf vdev's I/O.
18016038816SMartin MatuskaThis includes histograms of individual I/O (ind) and aggregate I/O (agg).
18116038816SMartin MatuskaThese stats can be useful for observing how well I/O aggregation is working.
18216038816SMartin MatuskaNote that TRIM I/O may exceed 16M, but will be counted as 16M.
183eda14cbcSMatt Macy.It Fl v
184eda14cbcSMatt MacyVerbose statistics Reports usage statistics for individual vdevs within the
185eda14cbcSMatt Macypool, in addition to the pool-wide statistics.
186eda14cbcSMatt Macy.It Fl y
18716038816SMartin MatuskaNormally the first line of output reports the statistics since boot:
18816038816SMartin Matuskasuppress it.
189eda14cbcSMatt Macy.It Fl w
190eda14cbcSMatt MacyDisplay latency histograms:
19116038816SMartin Matuska.Bl -tag -compact -width "asyncq_read/write"
19216038816SMartin Matuska.It Sy total_wait
19316038816SMartin MatuskaTotal I/O time (queuing + disk I/O time).
19416038816SMartin Matuska.It Sy disk_wait
19516038816SMartin MatuskaDisk I/O time (time reading/writing the disk).
19616038816SMartin Matuska.It Sy syncq_wait
19716038816SMartin MatuskaAmount of time I/O spent in synchronous priority queues.
19816038816SMartin MatuskaDoes not include disk time.
19916038816SMartin Matuska.It Sy asyncq_wait
20016038816SMartin MatuskaAmount of time I/O spent in asynchronous priority queues.
20116038816SMartin MatuskaDoes not include disk time.
20216038816SMartin Matuska.It Sy scrub
20316038816SMartin MatuskaAmount of time I/O spent in scrub queue.
20416038816SMartin MatuskaDoes not include disk time.
20521b492edSMartin Matuska.It Sy rebuild
20621b492edSMartin MatuskaAmount of time I/O spent in rebuild queue.
20721b492edSMartin MatuskaDoes not include disk time.
20816038816SMartin Matuska.El
209eda14cbcSMatt Macy.It Fl l
210eda14cbcSMatt MacyInclude average latency statistics:
21116038816SMartin Matuska.Bl -tag -compact -width "asyncq_read/write"
21216038816SMartin Matuska.It Sy total_wait
21316038816SMartin MatuskaAverage total I/O time (queuing + disk I/O time).
21416038816SMartin Matuska.It Sy disk_wait
21516038816SMartin MatuskaAverage disk I/O time (time reading/writing the disk).
21616038816SMartin Matuska.It Sy syncq_wait
21716038816SMartin MatuskaAverage amount of time I/O spent in synchronous priority queues.
218eda14cbcSMatt MacyDoes not include disk time.
21916038816SMartin Matuska.It Sy asyncq_wait
22016038816SMartin MatuskaAverage amount of time I/O spent in asynchronous priority queues.
22116038816SMartin MatuskaDoes not include disk time.
22216038816SMartin Matuska.It Sy scrub
22316038816SMartin MatuskaAverage queuing time in scrub queue.
22416038816SMartin MatuskaDoes not include disk time.
22516038816SMartin Matuska.It Sy trim
22616038816SMartin MatuskaAverage queuing time in trim queue.
22716038816SMartin MatuskaDoes not include disk time.
22821b492edSMartin Matuska.It Sy rebuild
22921b492edSMartin MatuskaAverage queuing time in rebuild queue.
23021b492edSMartin MatuskaDoes not include disk time.
23116038816SMartin Matuska.El
232eda14cbcSMatt Macy.It Fl q
23316038816SMartin MatuskaInclude active queue statistics.
23416038816SMartin MatuskaEach priority queue has both pending
23516038816SMartin Matuska.Sy ( pend )
23616038816SMartin Matuskaand active
23716038816SMartin Matuska.Sy ( activ )
23816038816SMartin MatuskaI/O requests.
23916038816SMartin MatuskaPending requests are waiting to be issued to the disk,
24016038816SMartin Matuskaand active requests have been issued to disk and are waiting for completion.
24116038816SMartin MatuskaThese stats are broken out by priority queue:
24216038816SMartin Matuska.Bl -tag -compact -width "asyncq_read/write"
24316038816SMartin Matuska.It Sy syncq_read/write
244eda14cbcSMatt MacyCurrent number of entries in synchronous priority
245eda14cbcSMatt Macyqueues.
24616038816SMartin Matuska.It Sy asyncq_read/write
247eda14cbcSMatt MacyCurrent number of entries in asynchronous priority queues.
24816038816SMartin Matuska.It Sy scrubq_read
249eda14cbcSMatt MacyCurrent number of entries in scrub queue.
25016038816SMartin Matuska.It Sy trimq_write
251eda14cbcSMatt MacyCurrent number of entries in trim queue.
25221b492edSMartin Matuska.It Sy rebuildq_write
25321b492edSMartin MatuskaCurrent number of entries in rebuild queue.
25416038816SMartin Matuska.El
255eda14cbcSMatt Macy.Pp
256eda14cbcSMatt MacyAll queue statistics are instantaneous measurements of the number of
25716038816SMartin Matuskaentries in the queues.
25816038816SMartin MatuskaIf you specify an interval,
25916038816SMartin Matuskathe measurements will be sampled from the end of the interval.
260eda14cbcSMatt Macy.El
26116038816SMartin Matuska.
262da5137abSMartin Matuska.Sh EXAMPLES
263da5137abSMartin Matuska.\" These are, respectively, examples 13, 16 from zpool.8
264da5137abSMartin Matuska.\" Make sure to update them bidirectionally
265da5137abSMartin Matuska.Ss Example 13 : No Adding Cache Devices to a ZFS Pool
266da5137abSMartin MatuskaThe following command adds two disks for use as cache devices to a ZFS storage
267da5137abSMartin Matuskapool:
268da5137abSMartin Matuska.Dl # Nm zpool Cm add Ar pool Sy cache Pa sdc sdd
269da5137abSMartin Matuska.Pp
270da5137abSMartin MatuskaOnce added, the cache devices gradually fill with content from main memory.
271da5137abSMartin MatuskaDepending on the size of your cache devices, it could take over an hour for
272da5137abSMartin Matuskathem to fill.
273da5137abSMartin MatuskaCapacity and reads can be monitored using the
274da5137abSMartin Matuska.Cm iostat
275da5137abSMartin Matuskasubcommand as follows:
276da5137abSMartin Matuska.Dl # Nm zpool Cm iostat Fl v Ar pool 5
277da5137abSMartin Matuska.
278da5137abSMartin Matuska.Ss Example 16 : No Adding output columns
279da5137abSMartin MatuskaAdditional columns can be added to the
280da5137abSMartin Matuska.Nm zpool Cm status No and Nm zpool Cm iostat No output with Fl c .
281da5137abSMartin Matuska.Bd -literal -compact -offset Ds
282da5137abSMartin Matuska.No # Nm zpool Cm status Fl c Pa vendor , Ns Pa model , Ns Pa size
283da5137abSMartin Matuska   NAME     STATE  READ WRITE CKSUM vendor  model        size
284da5137abSMartin Matuska   tank     ONLINE 0    0     0
285da5137abSMartin Matuska   mirror-0 ONLINE 0    0     0
286da5137abSMartin Matuska   U1       ONLINE 0    0     0     SEAGATE ST8000NM0075 7.3T
287da5137abSMartin Matuska   U10      ONLINE 0    0     0     SEAGATE ST8000NM0075 7.3T
288da5137abSMartin Matuska   U11      ONLINE 0    0     0     SEAGATE ST8000NM0075 7.3T
289da5137abSMartin Matuska   U12      ONLINE 0    0     0     SEAGATE ST8000NM0075 7.3T
290da5137abSMartin Matuska   U13      ONLINE 0    0     0     SEAGATE ST8000NM0075 7.3T
291da5137abSMartin Matuska   U14      ONLINE 0    0     0     SEAGATE ST8000NM0075 7.3T
292da5137abSMartin Matuska
293da5137abSMartin Matuska.No # Nm zpool Cm iostat Fl vc Pa size
294da5137abSMartin Matuska              capacity     operations     bandwidth
295da5137abSMartin Matuskapool        alloc   free   read  write   read  write  size
296da5137abSMartin Matuska----------  -----  -----  -----  -----  -----  -----  ----
297da5137abSMartin Matuskarpool       14.6G  54.9G      4     55   250K  2.69M
298da5137abSMartin Matuska  sda1      14.6G  54.9G      4     55   250K  2.69M   70G
299da5137abSMartin Matuska----------  -----  -----  -----  -----  -----  -----  ----
300da5137abSMartin Matuska.Ed
301da5137abSMartin Matuska.
302eda14cbcSMatt Macy.Sh SEE ALSO
303eda14cbcSMatt Macy.Xr iostat 1 ,
30416038816SMartin Matuska.Xr smartctl 8 ,
30516038816SMartin Matuska.Xr zpool-list 8 ,
30616038816SMartin Matuska.Xr zpool-status 8
307