xref: /freebsd/sys/contrib/openzfs/man/man1/ztest.1 (revision 77013d11e6483b970af25e13c9b892075742f7e5)
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) 2009 Oracle and/or its affiliates. All rights reserved.
22.\" Copyright (c) 2009 Michael Gebetsroither <michael.geb@gmx.at>. All rights
23.\" reserved.
24.\" Copyright (c) 2017, Intel Corporation.
25.\"
26.Dd May 26, 2021
27.Dt ZTEST 1
28.Os
29.
30.Sh NAME
31.Nm ztest
32.Nd was written by the ZFS Developers as a ZFS unit test
33.Sh SYNOPSIS
34.Nm
35.Op Fl VEG
36.Op Fl v Ar vdevs
37.Op Fl s Ar size_of_each_vdev
38.Op Fl a Ar alignment_shift
39.Op Fl m Ar mirror_copies
40.Op Fl r Ar raidz_disks/draid_disks
41.Op Fl R Ar raid_parity
42.Op Fl K Ar raid_kind
43.Op Fl D Ar draid_data
44.Op Fl S Ar draid_spares
45.Op Fl C Ar vdev_class_state
46.Op Fl d Ar datasets
47.Op Fl t Ar threads
48.Op Fl g Ar gang_block_threshold
49.Op Fl i Ar initialize_pool_i_times
50.Op Fl k Ar kill_percentage
51.Op Fl p Ar pool_name
52.Op Fl T Ar time
53.Op Fl z Ar zil_failure_rate
54.
55.Sh DESCRIPTION
56.Nm
57was written by the ZFS Developers as a ZFS unit test.
58The tool was developed in tandem with the ZFS functionality and was
59executed nightly as one of the many regression test against the daily build.
60As features were added to ZFS, unit tests were also added to
61.Nm .
62In addition, a separate test development team wrote and
63executed more functional and stress tests.
64.
65.Pp
66By default
67.Nm
68runs for ten minutes and uses block files
69(stored in
70.Pa /tmp )
71to create pools rather than using physical disks.
72Block files afford
73.Nm
74its flexibility to play around with
75zpool components without requiring large hardware configurations.
76However, storing the block files in
77.Pa /tmp
78may not work for you if you
79have a small tmp directory.
80.
81.Pp
82By default is non-verbose.
83This is why entering the command above will result in
84.Nm
85quietly executing for 5 minutes.
86The
87.Fl V
88option can be used to increase the verbosity of the tool.
89Adding multiple
90.Fl V
91options is allowed and the more you add the more chatty
92.Nm
93becomes.
94.
95.Pp
96After the
97.Nm
98run completes, you should notice many
99.Pa ztest.*
100files lying around.
101Once the run completes you can safely remove these files.
102Note that you shouldn't remove these files during a run.
103You can re-use these files in your next
104.Nm
105run by using the
106.Fl E
107option.
108.
109.Sh OPTIONS
110.Bl -tag -width "-v v"
111.It Fl h , \&? , -help
112Print a help summary.
113.It Fl v , -vdevs Ns = (default: Sy 5 )
114Number of vdevs.
115.It Fl s , -vdev-size Ns = (default: Sy 64M )
116Size of each vdev.
117.It Fl a , -alignment-shift Ns = (default: Sy 9 ) No (use Sy 0 No for random)
118Alignment shift used in test.
119.It Fl m , -mirror-copies Ns = (default: Sy 2 )
120Number of mirror copies.
121.It Fl r , -raid-disks Ns = (default: Sy 4 No for raidz/ Ns Sy 16 No for draid)
122Number of raidz/draid disks.
123.It Fl R , -raid-parity Ns = (default: Sy 1 )
124Raid parity (raidz & draid).
125.It Fl K , -raid-kind Ns = Ns Sy raidz Ns | Ns Sy draid Ns | Ns Sy random No (default: Sy random )
126The kind of RAID config to use.
127With
128.Sy random
129the kind alternates between raidz and draid.
130.It Fl D , -draid-data Ns = (default: Sy 4 )
131Number of data disks in a dRAID redundancy group.
132.It Fl S , -draid-spares Ns = (default: Sy 1 )
133Number of dRAID distributed spare disks.
134.It Fl d , -datasets Ns = (default: Sy 7 )
135Number of datasets.
136.It Fl t , -threads Ns = (default: Sy 23 )
137Number of threads.
138.It Fl g , -gang-block-threshold Ns = (default: Sy 32K )
139Gang block threshold.
140.It Fl i , -init-count Ns = (default: Sy 1 )
141Number of pool initializations.
142.It Fl k , -kill-percentage Ns = (default: Sy 70% )
143Kill percentage.
144.It Fl p , -pool-name Ns = (default: Sy ztest )
145Pool name.
146.It Fl f , -vdev-file-directory Ns = (default: Pa /tmp )
147File directory for vdev files.
148.It Fl M , -multi-host
149Multi-host; simulate pool imported on remote host.
150.It Fl E , -use-existing-pool
151Use existing pool (use existing pool instead of creating new one).
152.It Fl T , -run-time Ns = (default: Sy 300 Ns s)
153Total test run time.
154.It Fl P , -pass-time Ns = (default: Sy 60 Ns s)
155Time per pass.
156.It Fl F , -freeze-loops Ns = (default: Sy 50 )
157Max loops in
158.Fn spa_freeze .
159.It Fl B , -alt-ztest Ns =
160Alternate ztest path.
161.It Fl C , -vdev-class-state Ns = Ns Sy on Ns | Ns Sy off Ns | Ns Sy random No (default: Sy random )
162The vdev allocation class state.
163.It Fl o , -option Ns = Ns Ar variable Ns = Ns Ar value
164Set global
165.Ar variable
166to an unsigned 32-bit integer
167.Ar value
168(little-endian only).
169.It Fl G , -dump-debug
170Dump zfs_dbgmsg buffer before exiting due to an error.
171.It Fl V , -verbose
172Verbose (use multiple times for ever more verbosity).
173.El
174.
175.Sh EXAMPLES
176To override
177.Pa /tmp
178as your location for block files, you can use the
179.Fl f
180option:
181.Dl # ztest -f /
182.Pp
183To get an idea of what
184.Nm
185is actually testing try this:
186.Dl # ztest -f / -VVV
187.Pp
188Maybe you'd like to run
189.Nm ztest
190for longer? To do so simply use the
191.Fl T
192option and specify the runlength in seconds like so:
193.Dl # ztest -f / -V -T 120
194.
195.Sh ENVIRONMENT VARIABLES
196.Bl -tag -width "ZF"
197.It Ev ZFS_HOSTID Ns = Ns Em id
198Use
199.Em id
200instead of the SPL hostid to identify this host.
201Intended for use with
202.Nm , but this environment variable will affect any utility which uses
203libzpool, including
204.Xr zpool 8 .
205Since the kernel is unaware of this setting,
206results with utilities other than ztest are undefined.
207.It Ev ZFS_STACK_SIZE Ns = Ns Em stacksize
208Limit the default stack size to
209.Em stacksize
210bytes for the purpose of
211detecting and debugging kernel stack overflows.
212This value defaults to
213.Em 32K
214which is double the default
215.Em 16K
216Linux kernel stack size.
217.Pp
218In practice, setting the stack size slightly higher is needed because
219differences in stack usage between kernel and user space can lead to spurious
220stack overflows (especially when debugging is enabled).
221The specified value
222will be rounded up to a floor of PTHREAD_STACK_MIN which is the minimum stack
223required for a NULL procedure in user space.
224.Pp
225By default the stack size is limited to
226.Em 256K .
227.El
228.
229.Sh SEE ALSO
230.Xr zdb 1 ,
231.Xr zfs 1 ,
232.Xr zpool 1 ,
233.Xr spl 4
234