1*61145dc2SMartin Matuska.\" SPDX-License-Identifier: CDDL-1.0 2eda14cbcSMatt Macy.\" 3eda14cbcSMatt Macy.\" CDDL HEADER START 4eda14cbcSMatt Macy.\" 5eda14cbcSMatt Macy.\" The contents of this file are subject to the terms of the 6eda14cbcSMatt Macy.\" Common Development and Distribution License (the "License"). 7eda14cbcSMatt Macy.\" You may not use this file except in compliance with the License. 8eda14cbcSMatt Macy.\" 9eda14cbcSMatt Macy.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10271171e0SMartin Matuska.\" or https://opensource.org/licenses/CDDL-1.0. 11eda14cbcSMatt Macy.\" See the License for the specific language governing permissions 12eda14cbcSMatt Macy.\" and limitations under the License. 13eda14cbcSMatt Macy.\" 14eda14cbcSMatt Macy.\" When distributing Covered Code, include this CDDL HEADER in each 15eda14cbcSMatt Macy.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16eda14cbcSMatt Macy.\" If applicable, add the following below this CDDL HEADER, with the 17eda14cbcSMatt Macy.\" fields enclosed by brackets "[]" replaced with your own identifying 18eda14cbcSMatt Macy.\" information: Portions Copyright [yyyy] [name of copyright owner] 19eda14cbcSMatt Macy.\" 20eda14cbcSMatt Macy.\" CDDL HEADER END 21eda14cbcSMatt Macy.\" 22eda14cbcSMatt Macy.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. 23eda14cbcSMatt Macy.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved. 24eda14cbcSMatt Macy.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved. 25eda14cbcSMatt Macy.\" Copyright (c) 2017 Datto Inc. 26eda14cbcSMatt Macy.\" Copyright (c) 2018 George Melikov. All Rights Reserved. 27eda14cbcSMatt Macy.\" Copyright 2017 Nexenta Systems, Inc. 28eda14cbcSMatt Macy.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved. 29eda14cbcSMatt Macy.\" 30da5137abSMartin Matuska.Dd March 16, 2022 31eda14cbcSMatt Macy.Dt ZPOOL-IOSTAT 8 32eda14cbcSMatt Macy.Os 3316038816SMartin Matuska. 34eda14cbcSMatt Macy.Sh NAME 357877fdebSMatt Macy.Nm zpool-iostat 3616038816SMartin Matuska.Nd display logical I/O statistics for ZFS storage pools 37eda14cbcSMatt Macy.Sh SYNOPSIS 387877fdebSMatt Macy.Nm zpool 39eda14cbcSMatt Macy.Cm iostat 40eda14cbcSMatt Macy.Op Oo Oo Fl c Ar SCRIPT Oc Oo Fl lq Oc Oc Ns | Ns Fl rw 41eda14cbcSMatt Macy.Op Fl T Sy u Ns | Ns Sy d 42eda14cbcSMatt Macy.Op Fl ghHLnpPvy 4316038816SMartin Matuska.Oo Ar pool Ns … Ns | Ns Oo Ar pool vdev Ns … Oc Ns | Ns Ar vdev Ns … Oc 44eda14cbcSMatt Macy.Op Ar interval Op Ar count 4516038816SMartin Matuska. 46eda14cbcSMatt Macy.Sh DESCRIPTION 4716038816SMartin MatuskaDisplays logical I/O statistics for the given pools/vdevs. 4816038816SMartin MatuskaPhysical I/O statistics may be observed via 49eda14cbcSMatt Macy.Xr iostat 1 . 50eda14cbcSMatt MacyIf writes are located nearby, they may be merged into a single 5116038816SMartin Matuskalarger operation. 5216038816SMartin MatuskaAdditional I/O may be generated depending on the level of vdev redundancy. 53eda14cbcSMatt MacyTo filter output, you may pass in a list of pools, a pool and list of vdevs 5416038816SMartin Matuskain that pool, or a list of any vdevs from any pool. 5516038816SMartin MatuskaIf no items are specified, statistics for every pool in the system are shown. 56eda14cbcSMatt MacyWhen given an 57eda14cbcSMatt Macy.Ar interval , 58eda14cbcSMatt Macythe statistics are printed every 59eda14cbcSMatt Macy.Ar interval 6016038816SMartin Matuskaseconds until killed. 6116038816SMartin MatuskaIf 62eda14cbcSMatt Macy.Fl n 63eda14cbcSMatt Macyflag is specified the headers are displayed only once, otherwise they are 6416038816SMartin Matuskadisplayed periodically. 6516038816SMartin MatuskaIf 6616038816SMartin Matuska.Ar count 6716038816SMartin Matuskais specified, the command exits after 6816038816SMartin Matuska.Ar count 6916038816SMartin Matuskareports are printed. 70bb2d13b6SMartin MatuskaThe first report printed is always the statistics since boot regardless of 71bb2d13b6SMartin Matuskawhether 72eda14cbcSMatt Macy.Ar interval 73eda14cbcSMatt Macyand 74eda14cbcSMatt Macy.Ar count 7516038816SMartin Matuskaare passed. 7616038816SMartin MatuskaHowever, this behavior can be suppressed with the 77eda14cbcSMatt Macy.Fl y 7816038816SMartin Matuskaflag. 7916038816SMartin MatuskaAlso note that the units of 80eda14cbcSMatt Macy.Sy K , 81eda14cbcSMatt Macy.Sy M , 8216038816SMartin Matuska.Sy G Ns … 8316038816SMartin Matuskathat are printed in the report are in base 1024. 8416038816SMartin MatuskaTo get the raw values, use the 85eda14cbcSMatt Macy.Fl p 86eda14cbcSMatt Macyflag. 87eda14cbcSMatt Macy.Bl -tag -width Ds 8816038816SMartin Matuska.It Fl c Op Ar SCRIPT1 Ns Oo , Ns Ar SCRIPT2 Oc Ns … 89eda14cbcSMatt MacyRun a script (or scripts) on each vdev and include the output as a new column 90eda14cbcSMatt Macyin the 91eda14cbcSMatt Macy.Nm zpool Cm iostat 9216038816SMartin Matuskaoutput. 9316038816SMartin MatuskaUsers can run any script found in their 94eda14cbcSMatt Macy.Pa ~/.zpool.d 95eda14cbcSMatt Macydirectory or from the system 96eda14cbcSMatt Macy.Pa /etc/zfs/zpool.d 9716038816SMartin Matuskadirectory. 9816038816SMartin MatuskaScript names containing the slash 9916038816SMartin Matuska.Pq Sy / 10016038816SMartin Matuskacharacter are not allowed. 101eda14cbcSMatt MacyThe default search path can be overridden by setting the 10216038816SMartin Matuska.Sy ZPOOL_SCRIPTS_PATH 10316038816SMartin Matuskaenvironment variable. 10416038816SMartin MatuskaA privileged user can only run 105eda14cbcSMatt Macy.Fl c 10616038816SMartin Matuskaif they have the 10716038816SMartin Matuska.Sy ZPOOL_SCRIPTS_AS_ROOT 10816038816SMartin Matuskaenvironment variable set. 10916038816SMartin MatuskaIf a script requires the use of a privileged command, like 110eda14cbcSMatt Macy.Xr smartctl 8 , 111eda14cbcSMatt Macythen it's recommended you allow the user access to it in 112eda14cbcSMatt Macy.Pa /etc/sudoers 113eda14cbcSMatt Macyor add the user to the 114eda14cbcSMatt Macy.Pa /etc/sudoers.d/zfs 115eda14cbcSMatt Macyfile. 116eda14cbcSMatt Macy.Pp 117eda14cbcSMatt MacyIf 118eda14cbcSMatt Macy.Fl c 119eda14cbcSMatt Macyis passed without a script name, it prints a list of all scripts. 120eda14cbcSMatt Macy.Fl c 121eda14cbcSMatt Macyalso sets verbose mode 122eda14cbcSMatt Macy.No \&( Ns Fl v Ns No \&) . 123eda14cbcSMatt Macy.Pp 12416038816SMartin MatuskaScript output should be in the form of "name=value". 12516038816SMartin MatuskaThe column name is set to "name" and the value is set to "value". 12616038816SMartin MatuskaMultiple lines can be used to output multiple columns. 12716038816SMartin MatuskaThe first line of output not in the 12816038816SMartin Matuska"name=value" format is displayed without a column title, 12916038816SMartin Matuskaand no more output after that is displayed. 13016038816SMartin MatuskaThis can be useful for printing error messages. 13116038816SMartin MatuskaBlank or NULL values are printed as a '-' to make output AWKable. 132eda14cbcSMatt Macy.Pp 133eda14cbcSMatt MacyThe following environment variables are set before running each script: 13416038816SMartin Matuska.Bl -tag -compact -width "VDEV_ENC_SYSFS_PATH" 135eda14cbcSMatt Macy.It Sy VDEV_PATH 136eda14cbcSMatt MacyFull path to the vdev 137eda14cbcSMatt Macy.It Sy VDEV_UPATH 13816038816SMartin MatuskaUnderlying path to the vdev 13916038816SMartin Matuska.Pq Pa /dev/sd* . 14016038816SMartin MatuskaFor use with device mapper, multipath, or partitioned vdevs. 141eda14cbcSMatt Macy.It Sy VDEV_ENC_SYSFS_PATH 142eda14cbcSMatt MacyThe sysfs path to the enclosure for the vdev (if any). 143eda14cbcSMatt Macy.El 144eda14cbcSMatt Macy.It Fl T Sy u Ns | Ns Sy d 145eda14cbcSMatt MacyDisplay a time stamp. 146eda14cbcSMatt MacySpecify 147eda14cbcSMatt Macy.Sy u 148eda14cbcSMatt Macyfor a printed representation of the internal representation of time. 149eda14cbcSMatt MacySee 150fd45b686SMartin Matuska.Xr time 1 . 151eda14cbcSMatt MacySpecify 152eda14cbcSMatt Macy.Sy d 153eda14cbcSMatt Macyfor standard date format. 154eda14cbcSMatt MacySee 155eda14cbcSMatt Macy.Xr date 1 . 156eda14cbcSMatt Macy.It Fl g 15716038816SMartin MatuskaDisplay vdev GUIDs instead of the normal device names. 15816038816SMartin MatuskaThese GUIDs can be used in place of device names for the zpool 159eda14cbcSMatt Macydetach/offline/remove/replace commands. 160eda14cbcSMatt Macy.It Fl H 16116038816SMartin MatuskaScripted mode. 16216038816SMartin MatuskaDo not display headers, and separate fields by a 163eda14cbcSMatt Macysingle tab instead of arbitrary space. 164eda14cbcSMatt Macy.It Fl L 16516038816SMartin MatuskaDisplay real paths for vdevs resolving all symbolic links. 16616038816SMartin MatuskaThis can be used to look up the current block device name regardless of the 167eda14cbcSMatt Macy.Pa /dev/disk/ 168eda14cbcSMatt Macypath used to open it. 169eda14cbcSMatt Macy.It Fl n 170eda14cbcSMatt MacyPrint headers only once when passed 171eda14cbcSMatt Macy.It Fl p 17216038816SMartin MatuskaDisplay numbers in parsable (exact) values. 17316038816SMartin MatuskaTime values are in nanoseconds. 174eda14cbcSMatt Macy.It Fl P 17516038816SMartin MatuskaDisplay full paths for vdevs instead of only the last component of the path. 17616038816SMartin MatuskaThis can be used in conjunction with the 177eda14cbcSMatt Macy.Fl L 178eda14cbcSMatt Macyflag. 179eda14cbcSMatt Macy.It Fl r 18016038816SMartin MatuskaPrint request size histograms for the leaf vdev's I/O. 18116038816SMartin MatuskaThis includes histograms of individual I/O (ind) and aggregate I/O (agg). 18216038816SMartin MatuskaThese stats can be useful for observing how well I/O aggregation is working. 18316038816SMartin MatuskaNote that TRIM I/O may exceed 16M, but will be counted as 16M. 184eda14cbcSMatt Macy.It Fl v 185eda14cbcSMatt MacyVerbose statistics Reports usage statistics for individual vdevs within the 186eda14cbcSMatt Macypool, in addition to the pool-wide statistics. 187eda14cbcSMatt Macy.It Fl y 18816038816SMartin MatuskaNormally the first line of output reports the statistics since boot: 18916038816SMartin Matuskasuppress it. 190eda14cbcSMatt Macy.It Fl w 191eda14cbcSMatt MacyDisplay latency histograms: 19216038816SMartin Matuska.Bl -tag -compact -width "asyncq_read/write" 19316038816SMartin Matuska.It Sy total_wait 19416038816SMartin MatuskaTotal I/O time (queuing + disk I/O time). 19516038816SMartin Matuska.It Sy disk_wait 19616038816SMartin MatuskaDisk I/O time (time reading/writing the disk). 19716038816SMartin Matuska.It Sy syncq_wait 19816038816SMartin MatuskaAmount of time I/O spent in synchronous priority queues. 19916038816SMartin MatuskaDoes not include disk time. 20016038816SMartin Matuska.It Sy asyncq_wait 20116038816SMartin MatuskaAmount of time I/O spent in asynchronous priority queues. 20216038816SMartin MatuskaDoes not include disk time. 20316038816SMartin Matuska.It Sy scrub 20416038816SMartin MatuskaAmount of time I/O spent in scrub queue. 20516038816SMartin MatuskaDoes not include disk time. 20621b492edSMartin Matuska.It Sy rebuild 20721b492edSMartin MatuskaAmount of time I/O spent in rebuild queue. 20821b492edSMartin MatuskaDoes not include disk time. 20916038816SMartin Matuska.El 210eda14cbcSMatt Macy.It Fl l 211eda14cbcSMatt MacyInclude average latency statistics: 21216038816SMartin Matuska.Bl -tag -compact -width "asyncq_read/write" 21316038816SMartin Matuska.It Sy total_wait 21416038816SMartin MatuskaAverage total I/O time (queuing + disk I/O time). 21516038816SMartin Matuska.It Sy disk_wait 21616038816SMartin MatuskaAverage disk I/O time (time reading/writing the disk). 21716038816SMartin Matuska.It Sy syncq_wait 21816038816SMartin MatuskaAverage amount of time I/O spent in synchronous priority queues. 219eda14cbcSMatt MacyDoes not include disk time. 22016038816SMartin Matuska.It Sy asyncq_wait 22116038816SMartin MatuskaAverage amount of time I/O spent in asynchronous priority queues. 22216038816SMartin MatuskaDoes not include disk time. 22316038816SMartin Matuska.It Sy scrub 22416038816SMartin MatuskaAverage queuing time in scrub queue. 22516038816SMartin MatuskaDoes not include disk time. 22616038816SMartin Matuska.It Sy trim 22716038816SMartin MatuskaAverage queuing time in trim queue. 22816038816SMartin MatuskaDoes not include disk time. 22921b492edSMartin Matuska.It Sy rebuild 23021b492edSMartin MatuskaAverage queuing time in rebuild queue. 23121b492edSMartin MatuskaDoes not include disk time. 23216038816SMartin Matuska.El 233eda14cbcSMatt Macy.It Fl q 23416038816SMartin MatuskaInclude active queue statistics. 23516038816SMartin MatuskaEach priority queue has both pending 23616038816SMartin Matuska.Sy ( pend ) 23716038816SMartin Matuskaand active 23816038816SMartin Matuska.Sy ( activ ) 23916038816SMartin MatuskaI/O requests. 24016038816SMartin MatuskaPending requests are waiting to be issued to the disk, 24116038816SMartin Matuskaand active requests have been issued to disk and are waiting for completion. 24216038816SMartin MatuskaThese stats are broken out by priority queue: 24316038816SMartin Matuska.Bl -tag -compact -width "asyncq_read/write" 24416038816SMartin Matuska.It Sy syncq_read/write 245eda14cbcSMatt MacyCurrent number of entries in synchronous priority 246eda14cbcSMatt Macyqueues. 24716038816SMartin Matuska.It Sy asyncq_read/write 248eda14cbcSMatt MacyCurrent number of entries in asynchronous priority queues. 24916038816SMartin Matuska.It Sy scrubq_read 250eda14cbcSMatt MacyCurrent number of entries in scrub queue. 25116038816SMartin Matuska.It Sy trimq_write 252eda14cbcSMatt MacyCurrent number of entries in trim queue. 25321b492edSMartin Matuska.It Sy rebuildq_write 25421b492edSMartin MatuskaCurrent number of entries in rebuild queue. 25516038816SMartin Matuska.El 256eda14cbcSMatt Macy.Pp 257eda14cbcSMatt MacyAll queue statistics are instantaneous measurements of the number of 25816038816SMartin Matuskaentries in the queues. 25916038816SMartin MatuskaIf you specify an interval, 26016038816SMartin Matuskathe measurements will be sampled from the end of the interval. 261eda14cbcSMatt Macy.El 26216038816SMartin Matuska. 263da5137abSMartin Matuska.Sh EXAMPLES 264da5137abSMartin Matuska.\" These are, respectively, examples 13, 16 from zpool.8 265da5137abSMartin Matuska.\" Make sure to update them bidirectionally 266da5137abSMartin Matuska.Ss Example 13 : No Adding Cache Devices to a ZFS Pool 267da5137abSMartin MatuskaThe following command adds two disks for use as cache devices to a ZFS storage 268da5137abSMartin Matuskapool: 269da5137abSMartin Matuska.Dl # Nm zpool Cm add Ar pool Sy cache Pa sdc sdd 270da5137abSMartin Matuska.Pp 271da5137abSMartin MatuskaOnce added, the cache devices gradually fill with content from main memory. 272da5137abSMartin MatuskaDepending on the size of your cache devices, it could take over an hour for 273da5137abSMartin Matuskathem to fill. 274da5137abSMartin MatuskaCapacity and reads can be monitored using the 275da5137abSMartin Matuska.Cm iostat 276da5137abSMartin Matuskasubcommand as follows: 277da5137abSMartin Matuska.Dl # Nm zpool Cm iostat Fl v Ar pool 5 278da5137abSMartin Matuska. 279da5137abSMartin Matuska.Ss Example 16 : No Adding output columns 280da5137abSMartin MatuskaAdditional columns can be added to the 281da5137abSMartin Matuska.Nm zpool Cm status No and Nm zpool Cm iostat No output with Fl c . 282da5137abSMartin Matuska.Bd -literal -compact -offset Ds 283da5137abSMartin Matuska.No # Nm zpool Cm status Fl c Pa vendor , Ns Pa model , Ns Pa size 284da5137abSMartin Matuska NAME STATE READ WRITE CKSUM vendor model size 285da5137abSMartin Matuska tank ONLINE 0 0 0 286da5137abSMartin Matuska mirror-0 ONLINE 0 0 0 287da5137abSMartin Matuska U1 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T 288da5137abSMartin Matuska U10 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T 289da5137abSMartin Matuska U11 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T 290da5137abSMartin Matuska U12 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T 291da5137abSMartin Matuska U13 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T 292da5137abSMartin Matuska U14 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T 293da5137abSMartin Matuska 294da5137abSMartin Matuska.No # Nm zpool Cm iostat Fl vc Pa size 295da5137abSMartin Matuska capacity operations bandwidth 296da5137abSMartin Matuskapool alloc free read write read write size 297da5137abSMartin Matuska---------- ----- ----- ----- ----- ----- ----- ---- 298da5137abSMartin Matuskarpool 14.6G 54.9G 4 55 250K 2.69M 299da5137abSMartin Matuska sda1 14.6G 54.9G 4 55 250K 2.69M 70G 300da5137abSMartin Matuska---------- ----- ----- ----- ----- ----- ----- ---- 301da5137abSMartin Matuska.Ed 302da5137abSMartin Matuska. 303eda14cbcSMatt Macy.Sh SEE ALSO 304eda14cbcSMatt Macy.Xr iostat 1 , 30516038816SMartin Matuska.Xr smartctl 8 , 30616038816SMartin Matuska.Xr zpool-list 8 , 30716038816SMartin Matuska.Xr zpool-status 8 308