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 9*271171e0SMartin 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) 2009 Oracle and/or its affiliates. All rights reserved. 22eda14cbcSMatt Macy.\" Copyright (c) 2009 Michael Gebetsroither <michael.geb@gmx.at>. All rights 23eda14cbcSMatt Macy.\" reserved. 247877fdebSMatt Macy.\" Copyright (c) 2017, Intel Corporation. 25eda14cbcSMatt Macy.\" 2616038816SMartin Matuska.Dd May 26, 2021 2716038816SMartin Matuska.Dt ZTEST 1 2816038816SMartin Matuska.Os 2916038816SMartin Matuska. 3016038816SMartin Matuska.Sh NAME 3116038816SMartin Matuska.Nm ztest 3216038816SMartin Matuska.Nd was written by the ZFS Developers as a ZFS unit test 3316038816SMartin Matuska.Sh SYNOPSIS 3416038816SMartin Matuska.Nm 3516038816SMartin Matuska.Op Fl VEG 3616038816SMartin Matuska.Op Fl v Ar vdevs 3716038816SMartin Matuska.Op Fl s Ar size_of_each_vdev 3816038816SMartin Matuska.Op Fl a Ar alignment_shift 3916038816SMartin Matuska.Op Fl m Ar mirror_copies 4016038816SMartin Matuska.Op Fl r Ar raidz_disks/draid_disks 4116038816SMartin Matuska.Op Fl R Ar raid_parity 4216038816SMartin Matuska.Op Fl K Ar raid_kind 4316038816SMartin Matuska.Op Fl D Ar draid_data 4416038816SMartin Matuska.Op Fl S Ar draid_spares 4516038816SMartin Matuska.Op Fl C Ar vdev_class_state 4616038816SMartin Matuska.Op Fl d Ar datasets 4716038816SMartin Matuska.Op Fl t Ar threads 4816038816SMartin Matuska.Op Fl g Ar gang_block_threshold 4916038816SMartin Matuska.Op Fl i Ar initialize_pool_i_times 5016038816SMartin Matuska.Op Fl k Ar kill_percentage 5116038816SMartin Matuska.Op Fl p Ar pool_name 5216038816SMartin Matuska.Op Fl T Ar time 5316038816SMartin Matuska.Op Fl z Ar zil_failure_rate 5416038816SMartin Matuska. 5516038816SMartin Matuska.Sh DESCRIPTION 5616038816SMartin Matuska.Nm 5716038816SMartin Matuskawas written by the ZFS Developers as a ZFS unit test. 5816038816SMartin MatuskaThe tool was developed in tandem with the ZFS functionality and was 5916038816SMartin Matuskaexecuted nightly as one of the many regression test against the daily build. 6016038816SMartin MatuskaAs features were added to ZFS, unit tests were also added to 6116038816SMartin Matuska.Nm . 6216038816SMartin MatuskaIn addition, a separate test development team wrote and 63eda14cbcSMatt Macyexecuted more functional and stress tests. 6416038816SMartin Matuska. 6516038816SMartin Matuska.Pp 6616038816SMartin MatuskaBy default 6716038816SMartin Matuska.Nm 6816038816SMartin Matuskaruns for ten minutes and uses block files 6916038816SMartin Matuska(stored in 7016038816SMartin Matuska.Pa /tmp ) 7116038816SMartin Matuskato create pools rather than using physical disks. 7216038816SMartin MatuskaBlock files afford 7316038816SMartin Matuska.Nm 7416038816SMartin Matuskaits flexibility to play around with 75eda14cbcSMatt Macyzpool components without requiring large hardware configurations. 7616038816SMartin MatuskaHowever, storing the block files in 7716038816SMartin Matuska.Pa /tmp 7816038816SMartin Matuskamay not work for you if you 79eda14cbcSMatt Macyhave a small tmp directory. 8016038816SMartin Matuska. 8116038816SMartin Matuska.Pp 8216038816SMartin MatuskaBy default is non-verbose. 8316038816SMartin MatuskaThis is why entering the command above will result in 8416038816SMartin Matuska.Nm 8516038816SMartin Matuskaquietly executing for 5 minutes. 8616038816SMartin MatuskaThe 8716038816SMartin Matuska.Fl V 8816038816SMartin Matuskaoption can be used to increase the verbosity of the tool. 8916038816SMartin MatuskaAdding multiple 9016038816SMartin Matuska.Fl V 9116038816SMartin Matuskaoptions is allowed and the more you add the more chatty 9216038816SMartin Matuska.Nm 93eda14cbcSMatt Macybecomes. 9416038816SMartin Matuska. 9516038816SMartin Matuska.Pp 9616038816SMartin MatuskaAfter the 9716038816SMartin Matuska.Nm 9816038816SMartin Matuskarun completes, you should notice many 9916038816SMartin Matuska.Pa ztest.* 10016038816SMartin Matuskafiles lying around. 10116038816SMartin MatuskaOnce the run completes you can safely remove these files. 10216038816SMartin MatuskaNote that you shouldn't remove these files during a run. 10316038816SMartin MatuskaYou can re-use these files in your next 10416038816SMartin Matuska.Nm 10516038816SMartin Matuskarun by using the 10616038816SMartin Matuska.Fl E 107eda14cbcSMatt Macyoption. 10816038816SMartin Matuska. 10916038816SMartin Matuska.Sh OPTIONS 11016038816SMartin Matuska.Bl -tag -width "-v v" 11116038816SMartin Matuska.It Fl h , \&? , -help 112eda14cbcSMatt MacyPrint a help summary. 11316038816SMartin Matuska.It Fl v , -vdevs Ns = (default: Sy 5 ) 114eda14cbcSMatt MacyNumber of vdevs. 11516038816SMartin Matuska.It Fl s , -vdev-size Ns = (default: Sy 64M ) 116eda14cbcSMatt MacySize of each vdev. 11716038816SMartin Matuska.It Fl a , -alignment-shift Ns = (default: Sy 9 ) No (use Sy 0 No for random) 11816038816SMartin MatuskaAlignment shift used in test. 11916038816SMartin Matuska.It Fl m , -mirror-copies Ns = (default: Sy 2 ) 120eda14cbcSMatt MacyNumber of mirror copies. 12116038816SMartin Matuska.It Fl r , -raid-disks Ns = (default: Sy 4 No for raidz/ Ns Sy 16 No for draid) 12216038816SMartin MatuskaNumber of raidz/draid disks. 12316038816SMartin Matuska.It Fl R , -raid-parity Ns = (default: Sy 1 ) 1247877fdebSMatt MacyRaid parity (raidz & draid). 12516038816SMartin Matuska.It Fl K , -raid-kind Ns = Ns Sy raidz Ns | Ns Sy draid Ns | Ns Sy random No (default: Sy random ) 12616038816SMartin MatuskaThe kind of RAID config to use. 12716038816SMartin MatuskaWith 12816038816SMartin Matuska.Sy random 12916038816SMartin Matuskathe kind alternates between raidz and draid. 13016038816SMartin Matuska.It Fl D , -draid-data Ns = (default: Sy 4 ) 1317877fdebSMatt MacyNumber of data disks in a dRAID redundancy group. 13216038816SMartin Matuska.It Fl S , -draid-spares Ns = (default: Sy 1 ) 1337877fdebSMatt MacyNumber of dRAID distributed spare disks. 13416038816SMartin Matuska.It Fl d , -datasets Ns = (default: Sy 7 ) 135eda14cbcSMatt MacyNumber of datasets. 13616038816SMartin Matuska.It Fl t , -threads Ns = (default: Sy 23 ) 137eda14cbcSMatt MacyNumber of threads. 13816038816SMartin Matuska.It Fl g , -gang-block-threshold Ns = (default: Sy 32K ) 139eda14cbcSMatt MacyGang block threshold. 14016038816SMartin Matuska.It Fl i , -init-count Ns = (default: Sy 1 ) 14116038816SMartin MatuskaNumber of pool initializations. 14216038816SMartin Matuska.It Fl k , -kill-percentage Ns = (default: Sy 70% ) 143eda14cbcSMatt MacyKill percentage. 14416038816SMartin Matuska.It Fl p , -pool-name Ns = (default: Sy ztest ) 145eda14cbcSMatt MacyPool name. 14616038816SMartin Matuska.It Fl f , -vdev-file-directory Ns = (default: Pa /tmp ) 14716038816SMartin MatuskaFile directory for vdev files. 14816038816SMartin Matuska.It Fl M , -multi-host 14916038816SMartin MatuskaMulti-host; simulate pool imported on remote host. 15016038816SMartin Matuska.It Fl E , -use-existing-pool 151eda14cbcSMatt MacyUse existing pool (use existing pool instead of creating new one). 15216038816SMartin Matuska.It Fl T , -run-time Ns = (default: Sy 300 Ns s) 153eda14cbcSMatt MacyTotal test run time. 15416038816SMartin Matuska.It Fl P , -pass-time Ns = (default: Sy 60 Ns s) 15516038816SMartin MatuskaTime per pass. 15616038816SMartin Matuska.It Fl F , -freeze-loops Ns = (default: Sy 50 ) 15716038816SMartin MatuskaMax loops in 15816038816SMartin Matuska.Fn spa_freeze . 15916038816SMartin Matuska.It Fl B , -alt-ztest Ns = 160716fd348SMartin MatuskaPath to alternate ("older") 161716fd348SMartin Matuska.Nm ztest 162716fd348SMartin Matuskato drive, which will be used to initialise the pool, and, a stochastic half the time, to run the tests. 163716fd348SMartin MatuskaThe parallel 164716fd348SMartin Matuska.Pa lib 165716fd348SMartin Matuskadirectory is prepended to 166716fd348SMartin Matuska.Ev LD_LIBRARY_PATH ; 167716fd348SMartin Matuskai.e. given 168716fd348SMartin Matuska.Fl B Pa ./chroots/lenny/usr/bin/ Ns Nm , 169716fd348SMartin Matuska.Pa ./chroots/lenny/usr/lib 170716fd348SMartin Matuskawill be loaded. 17116038816SMartin Matuska.It Fl C , -vdev-class-state Ns = Ns Sy on Ns | Ns Sy off Ns | Ns Sy random No (default: Sy random ) 17216038816SMartin MatuskaThe vdev allocation class state. 17316038816SMartin Matuska.It Fl o , -option Ns = Ns Ar variable Ns = Ns Ar value 17416038816SMartin MatuskaSet global 17516038816SMartin Matuska.Ar variable 17616038816SMartin Matuskato an unsigned 32-bit integer 17716038816SMartin Matuska.Ar value 17816038816SMartin Matuska(little-endian only). 17916038816SMartin Matuska.It Fl G , -dump-debug 18016038816SMartin MatuskaDump zfs_dbgmsg buffer before exiting due to an error. 18116038816SMartin Matuska.It Fl V , -verbose 18216038816SMartin MatuskaVerbose (use multiple times for ever more verbosity). 18316038816SMartin Matuska.El 18416038816SMartin Matuska. 18516038816SMartin Matuska.Sh EXAMPLES 18616038816SMartin MatuskaTo override 18716038816SMartin Matuska.Pa /tmp 18816038816SMartin Matuskaas your location for block files, you can use the 18916038816SMartin Matuska.Fl f 190eda14cbcSMatt Macyoption: 19116038816SMartin Matuska.Dl # ztest -f / 19216038816SMartin Matuska.Pp 19316038816SMartin MatuskaTo get an idea of what 19416038816SMartin Matuska.Nm 19516038816SMartin Matuskais actually testing try this: 19616038816SMartin Matuska.Dl # ztest -f / -VVV 19716038816SMartin Matuska.Pp 19816038816SMartin MatuskaMaybe you'd like to run 19916038816SMartin Matuska.Nm ztest 20016038816SMartin Matuskafor longer? To do so simply use the 20116038816SMartin Matuska.Fl T 202eda14cbcSMatt Macyoption and specify the runlength in seconds like so: 20316038816SMartin Matuska.Dl # ztest -f / -V -T 120 20416038816SMartin Matuska. 20516038816SMartin Matuska.Sh ENVIRONMENT VARIABLES 20616038816SMartin Matuska.Bl -tag -width "ZF" 20716038816SMartin Matuska.It Ev ZFS_HOSTID Ns = Ns Em id 20816038816SMartin MatuskaUse 20916038816SMartin Matuska.Em id 21016038816SMartin Matuskainstead of the SPL hostid to identify this host. 21116038816SMartin MatuskaIntended for use with 21216038816SMartin Matuska.Nm , but this environment variable will affect any utility which uses 21316038816SMartin Matuskalibzpool, including 21416038816SMartin Matuska.Xr zpool 8 . 21516038816SMartin MatuskaSince the kernel is unaware of this setting, 216eda14cbcSMatt Macyresults with utilities other than ztest are undefined. 21716038816SMartin Matuska.It Ev ZFS_STACK_SIZE Ns = Ns Em stacksize 21816038816SMartin MatuskaLimit the default stack size to 21916038816SMartin Matuska.Em stacksize 22016038816SMartin Matuskabytes for the purpose of 22116038816SMartin Matuskadetecting and debugging kernel stack overflows. 22216038816SMartin MatuskaThis value defaults to 22316038816SMartin Matuska.Em 32K 22416038816SMartin Matuskawhich is double the default 22516038816SMartin Matuska.Em 16K 22616038816SMartin MatuskaLinux kernel stack size. 22716038816SMartin Matuska.Pp 228eda14cbcSMatt MacyIn practice, setting the stack size slightly higher is needed because 229eda14cbcSMatt Macydifferences in stack usage between kernel and user space can lead to spurious 23016038816SMartin Matuskastack overflows (especially when debugging is enabled). 23116038816SMartin MatuskaThe specified value 232eda14cbcSMatt Macywill be rounded up to a floor of PTHREAD_STACK_MIN which is the minimum stack 233eda14cbcSMatt Macyrequired for a NULL procedure in user space. 23416038816SMartin Matuska.Pp 23516038816SMartin MatuskaBy default the stack size is limited to 23616038816SMartin Matuska.Em 256K . 23716038816SMartin Matuska.El 23816038816SMartin Matuska. 23916038816SMartin Matuska.Sh SEE ALSO 24016038816SMartin Matuska.Xr zdb 1 , 24116038816SMartin Matuska.Xr zfs 1 , 24216038816SMartin Matuska.Xr zpool 1 , 2433ff01b23SMartin Matuska.Xr spl 4 244