xref: /freebsd/sys/contrib/openzfs/man/man1/ztest.1 (revision e716630d4cf89e69ec3f675ebfceee09f1a85e05)
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) 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.
55*e716630dSMartin Matuska.Nm
56*e716630dSMartin Matuska.Fl X
57*e716630dSMartin Matuska.Op Fl VG
58*e716630dSMartin Matuska.Op Fl s Ar size_of_each_vdev
59*e716630dSMartin Matuska.Op Fl a Ar alignment_shift
60*e716630dSMartin Matuska.Op Fl r Ar raidz_disks
61*e716630dSMartin Matuska.Op Fl R Ar raid_parity
62*e716630dSMartin Matuska.Op Fl d Ar datasets
63*e716630dSMartin Matuska.Op Fl t Ar threads
64*e716630dSMartin Matuska.
6516038816SMartin Matuska.Sh DESCRIPTION
6616038816SMartin Matuska.Nm
6716038816SMartin Matuskawas written by the ZFS Developers as a ZFS unit test.
6816038816SMartin MatuskaThe tool was developed in tandem with the ZFS functionality and was
6916038816SMartin Matuskaexecuted nightly as one of the many regression test against the daily build.
7016038816SMartin MatuskaAs features were added to ZFS, unit tests were also added to
7116038816SMartin Matuska.Nm .
7216038816SMartin MatuskaIn addition, a separate test development team wrote and
73eda14cbcSMatt Macyexecuted more functional and stress tests.
7416038816SMartin Matuska.
7516038816SMartin Matuska.Pp
7616038816SMartin MatuskaBy default
7716038816SMartin Matuska.Nm
7816038816SMartin Matuskaruns for ten minutes and uses block files
7916038816SMartin Matuska(stored in
8016038816SMartin Matuska.Pa /tmp )
8116038816SMartin Matuskato create pools rather than using physical disks.
8216038816SMartin MatuskaBlock files afford
8316038816SMartin Matuska.Nm
8416038816SMartin Matuskaits flexibility to play around with
85eda14cbcSMatt Macyzpool components without requiring large hardware configurations.
8616038816SMartin MatuskaHowever, storing the block files in
8716038816SMartin Matuska.Pa /tmp
8816038816SMartin Matuskamay not work for you if you
89eda14cbcSMatt Macyhave a small tmp directory.
9016038816SMartin Matuska.
9116038816SMartin Matuska.Pp
9216038816SMartin MatuskaBy default is non-verbose.
9316038816SMartin MatuskaThis is why entering the command above will result in
9416038816SMartin Matuska.Nm
9516038816SMartin Matuskaquietly executing for 5 minutes.
9616038816SMartin MatuskaThe
9716038816SMartin Matuska.Fl V
9816038816SMartin Matuskaoption can be used to increase the verbosity of the tool.
9916038816SMartin MatuskaAdding multiple
10016038816SMartin Matuska.Fl V
10116038816SMartin Matuskaoptions is allowed and the more you add the more chatty
10216038816SMartin Matuska.Nm
103eda14cbcSMatt Macybecomes.
10416038816SMartin Matuska.
10516038816SMartin Matuska.Pp
10616038816SMartin MatuskaAfter the
10716038816SMartin Matuska.Nm
10816038816SMartin Matuskarun completes, you should notice many
10916038816SMartin Matuska.Pa ztest.*
11016038816SMartin Matuskafiles lying around.
11116038816SMartin MatuskaOnce the run completes you can safely remove these files.
11216038816SMartin MatuskaNote that you shouldn't remove these files during a run.
11316038816SMartin MatuskaYou can re-use these files in your next
11416038816SMartin Matuska.Nm
11516038816SMartin Matuskarun by using the
11616038816SMartin Matuska.Fl E
117eda14cbcSMatt Macyoption.
11816038816SMartin Matuska.
11916038816SMartin Matuska.Sh OPTIONS
12016038816SMartin Matuska.Bl -tag -width "-v v"
12116038816SMartin Matuska.It Fl h , \&? , -help
122eda14cbcSMatt MacyPrint a help summary.
12316038816SMartin Matuska.It Fl v , -vdevs Ns = (default: Sy 5 )
124eda14cbcSMatt MacyNumber of vdevs.
12516038816SMartin Matuska.It Fl s , -vdev-size Ns = (default: Sy 64M )
126eda14cbcSMatt MacySize of each vdev.
12716038816SMartin Matuska.It Fl a , -alignment-shift Ns = (default: Sy 9 ) No (use Sy 0 No for random )
12816038816SMartin MatuskaAlignment shift used in test.
12916038816SMartin Matuska.It Fl m , -mirror-copies Ns = (default: Sy 2 )
130eda14cbcSMatt MacyNumber of mirror copies.
13116038816SMartin Matuska.It Fl r , -raid-disks Ns = (default: Sy 4 No for raidz/ Ns Sy 16 No for draid )
13216038816SMartin MatuskaNumber of raidz/draid disks.
13316038816SMartin Matuska.It Fl R , -raid-parity Ns = (default: Sy 1 )
1347877fdebSMatt MacyRaid parity (raidz & draid).
135*e716630dSMartin Matuska.It Xo
136*e716630dSMartin Matuska.Fl K , -raid-kind Ns = Ns
137*e716630dSMartin Matuska.Sy raidz Ns | Ns Sy eraidz Ns | Ns Sy draid Ns | Ns Sy random
138*e716630dSMartin Matuska(default:
139*e716630dSMartin Matuska.Sy random Ns
140*e716630dSMartin Matuska)
141*e716630dSMartin Matuska.Xc
14216038816SMartin MatuskaThe kind of RAID config to use.
14316038816SMartin MatuskaWith
14416038816SMartin Matuska.Sy random
145*e716630dSMartin Matuskathe kind alternates between raidz, eraidz (expandable raidz) and draid.
14616038816SMartin Matuska.It Fl D , -draid-data Ns = (default: Sy 4 )
1477877fdebSMatt MacyNumber of data disks in a dRAID redundancy group.
14816038816SMartin Matuska.It Fl S , -draid-spares Ns = (default: Sy 1 )
1497877fdebSMatt MacyNumber of dRAID distributed spare disks.
15016038816SMartin Matuska.It Fl d , -datasets Ns = (default: Sy 7 )
151eda14cbcSMatt MacyNumber of datasets.
15216038816SMartin Matuska.It Fl t , -threads Ns = (default: Sy 23 )
153eda14cbcSMatt MacyNumber of threads.
15416038816SMartin Matuska.It Fl g , -gang-block-threshold Ns = (default: Sy 32K )
155eda14cbcSMatt MacyGang block threshold.
15616038816SMartin Matuska.It Fl i , -init-count Ns = (default: Sy 1 )
15716038816SMartin MatuskaNumber of pool initializations.
15816038816SMartin Matuska.It Fl k , -kill-percentage Ns = (default: Sy 70% )
159eda14cbcSMatt MacyKill percentage.
16016038816SMartin Matuska.It Fl p , -pool-name Ns = (default: Sy ztest )
161eda14cbcSMatt MacyPool name.
16216038816SMartin Matuska.It Fl f , -vdev-file-directory Ns = (default: Pa /tmp )
16316038816SMartin MatuskaFile directory for vdev files.
16416038816SMartin Matuska.It Fl M , -multi-host
16516038816SMartin MatuskaMulti-host; simulate pool imported on remote host.
16616038816SMartin Matuska.It Fl E , -use-existing-pool
167eda14cbcSMatt MacyUse existing pool (use existing pool instead of creating new one).
16816038816SMartin Matuska.It Fl T , -run-time Ns = (default: Sy 300 Ns s)
169eda14cbcSMatt MacyTotal test run time.
17016038816SMartin Matuska.It Fl P , -pass-time Ns = (default: Sy 60 Ns s)
17116038816SMartin MatuskaTime per pass.
17216038816SMartin Matuska.It Fl F , -freeze-loops Ns = (default: Sy 50 )
17316038816SMartin MatuskaMax loops in
17416038816SMartin Matuska.Fn spa_freeze .
17516038816SMartin Matuska.It Fl B , -alt-ztest Ns =
176716fd348SMartin MatuskaPath to alternate ("older")
177716fd348SMartin Matuska.Nm ztest
178bb2d13b6SMartin Matuskato drive, which will be used to initialise the pool, and, a stochastic half the
179bb2d13b6SMartin Matuskatime, to run the tests.
180716fd348SMartin MatuskaThe parallel
181716fd348SMartin Matuska.Pa lib
182716fd348SMartin Matuskadirectory is prepended to
183716fd348SMartin Matuska.Ev LD_LIBRARY_PATH ;
184716fd348SMartin Matuskai.e. given
185716fd348SMartin Matuska.Fl B Pa ./chroots/lenny/usr/bin/ Ns Nm ,
186716fd348SMartin Matuska.Pa ./chroots/lenny/usr/lib
187716fd348SMartin Matuskawill be loaded.
18816038816SMartin Matuska.It Fl C , -vdev-class-state Ns = Ns Sy on Ns | Ns Sy off Ns | Ns Sy random No (default : Sy random  )
18916038816SMartin MatuskaThe vdev allocation class state.
19016038816SMartin Matuska.It Fl o , -option Ns = Ns Ar variable Ns = Ns Ar value
19116038816SMartin MatuskaSet global
19216038816SMartin Matuska.Ar variable
19316038816SMartin Matuskato an unsigned 32-bit integer
19416038816SMartin Matuska.Ar value
19516038816SMartin Matuska(little-endian only).
19616038816SMartin Matuska.It Fl G , -dump-debug
19716038816SMartin MatuskaDump zfs_dbgmsg buffer before exiting due to an error.
19816038816SMartin Matuska.It Fl V , -verbose
19916038816SMartin MatuskaVerbose (use multiple times for ever more verbosity).
200*e716630dSMartin Matuska.It Fl X , -raidz-expansion
201*e716630dSMartin MatuskaPerform a dedicated raidz expansion test.
20216038816SMartin Matuska.El
20316038816SMartin Matuska.
20416038816SMartin Matuska.Sh EXAMPLES
20516038816SMartin MatuskaTo override
20616038816SMartin Matuska.Pa /tmp
20716038816SMartin Matuskaas your location for block files, you can use the
20816038816SMartin Matuska.Fl f
209eda14cbcSMatt Macyoption:
21016038816SMartin Matuska.Dl # ztest -f /
21116038816SMartin Matuska.Pp
21216038816SMartin MatuskaTo get an idea of what
21316038816SMartin Matuska.Nm
21416038816SMartin Matuskais actually testing try this:
21516038816SMartin Matuska.Dl # ztest -f / -VVV
21616038816SMartin Matuska.Pp
21716038816SMartin MatuskaMaybe you'd like to run
21816038816SMartin Matuska.Nm ztest
21916038816SMartin Matuskafor longer? To do so simply use the
22016038816SMartin Matuska.Fl T
221eda14cbcSMatt Macyoption and specify the runlength in seconds like so:
22216038816SMartin Matuska.Dl # ztest -f / -V -T 120
22316038816SMartin Matuska.
22416038816SMartin Matuska.Sh ENVIRONMENT VARIABLES
22516038816SMartin Matuska.Bl -tag -width "ZF"
22616038816SMartin Matuska.It Ev ZFS_HOSTID Ns = Ns Em id
22716038816SMartin MatuskaUse
22816038816SMartin Matuska.Em id
22916038816SMartin Matuskainstead of the SPL hostid to identify this host.
23016038816SMartin MatuskaIntended for use with
23116038816SMartin Matuska.Nm , but this environment variable will affect any utility which uses
23216038816SMartin Matuskalibzpool, including
23316038816SMartin Matuska.Xr zpool 8 .
23416038816SMartin MatuskaSince the kernel is unaware of this setting,
235eda14cbcSMatt Macyresults with utilities other than ztest are undefined.
23616038816SMartin Matuska.It Ev ZFS_STACK_SIZE Ns = Ns Em stacksize
23716038816SMartin MatuskaLimit the default stack size to
23816038816SMartin Matuska.Em stacksize
23916038816SMartin Matuskabytes for the purpose of
24016038816SMartin Matuskadetecting and debugging kernel stack overflows.
24116038816SMartin MatuskaThis value defaults to
24216038816SMartin Matuska.Em 32K
24316038816SMartin Matuskawhich is double the default
24416038816SMartin Matuska.Em 16K
24516038816SMartin MatuskaLinux kernel stack size.
24616038816SMartin Matuska.Pp
247eda14cbcSMatt MacyIn practice, setting the stack size slightly higher is needed because
248eda14cbcSMatt Macydifferences in stack usage between kernel and user space can lead to spurious
24916038816SMartin Matuskastack overflows (especially when debugging is enabled).
25016038816SMartin MatuskaThe specified value
251eda14cbcSMatt Macywill be rounded up to a floor of PTHREAD_STACK_MIN which is the minimum stack
252eda14cbcSMatt Macyrequired for a NULL procedure in user space.
25316038816SMartin Matuska.Pp
25416038816SMartin MatuskaBy default the stack size is limited to
25516038816SMartin Matuska.Em 256K .
25616038816SMartin Matuska.El
25716038816SMartin Matuska.
25816038816SMartin Matuska.Sh SEE ALSO
25916038816SMartin Matuska.Xr zdb 1 ,
26016038816SMartin Matuska.Xr zfs 1 ,
26116038816SMartin Matuska.Xr zpool 1 ,
2623ff01b23SMartin Matuska.Xr spl 4
263