CDDL HEADER START
The contents of this file are subject to the terms of the
Common Development and Distribution License (the "License").
You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
or http://www.opensolaris.org/os/licensing.
See the License for the specific language governing permissions
and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each
file and include the License file at usr/src/OPENSOLARIS.LICENSE.
If applicable, add the following below this CDDL HEADER, with the
fields enclosed by brackets "[]" replaced with your own identifying
information: Portions Copyright [yyyy] [name of copyright owner]
CDDL HEADER END
Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2009 Michael Gebetsroither <michael.geb@gmx.at>. All rights
reserved.
Copyright (c) 2017, Intel Corporation.
"ztest <options>"
This manual page documents briefly the ztest command.
ztest was written by the ZFS Developers as a ZFS unit test. The tool was developed in tandem with the ZFS functionality and was executed nightly as one of the many regression test against the daily build. As features were added to ZFS, unit tests were also added to ztest. In addition, a separate test development team wrote and executed more functional and stress tests.
By default ztest runs for ten minutes and uses block files (stored in /tmp) to create pools rather than using physical disks. Block files afford ztest its flexibility to play around with zpool components without requiring large hardware configurations. However, storing the block files in /tmp may not work for you if you have a small tmp directory.
By default is non-verbose. This is why entering the command above will result in ztest quietly executing for 5 minutes. The -V option can be used to increase the verbosity of the tool. Adding multiple -V option is allowed and the more you add the more chatty ztest becomes.
After the ztest run completes, you should notice many ztest.* files lying around. Once the run completes you can safely remove these files. Note that you shouldn't remove these files during a run. You can re-use these files in your next ztest run by using the -E option.
"-?" ""
Print a help summary."-v" " vdevs" " (default: 5)
Number of vdevs."-s" " size_of_each_vdev" " (default: 64M)"
Size of each vdev."-a" " alignment_shift" " (default: 9) (use 0 for random)"
Used alignment in test."-m" " mirror_copies" " (default: 2)"
Number of mirror copies."-r" " raidz_disks / draid_disks" " (default: 4 / 16)"
Number of raidz disks."-R" " raid_parity" " (default: 1)"
Raid parity (raidz & draid)."-K" " raid_kind" " (default: 'random') raidz|draid|random"
The kind of RAID config to use. With 'random' the kind alternates between raidz and draid."-D" " draid_data" " (default: 4)"
Number of data disks in a dRAID redundancy group."-S" " draid_spares" " (default: 1)"
Number of dRAID distributed spare disks."-C" " vdev_class_state" " (default: random)"
The vdev allocation class state: special=on|off|random."-d" " datasets" " (default: 7)"
Number of datasets."-t" " threads" " (default: 23)"
Number of threads."-g" " gang_block_threshold" " (default: 32K)"
Gang block threshold."-i" " initialize_pool_i_times" " (default: 1)"
Number of pool initialisations."-k" " kill_percentage" " (default: 70%)"
Kill percentage."-p" " pool_name" " (default: ztest)"
Pool name."-V(erbose)"
Verbose (use multiple times for ever more blather)."-E(xisting)"
Use existing pool (use existing pool instead of creating new one)."-T" " time" " (default: 300 sec)"
Total test run time."-z" " zil_failure_rate" " (default: fail every 2^5 allocs)
Injected failure rate."-G"
Dump zfs_dbgmsg buffer before exiting.To override /tmp as your location for block files, you can use the -f option:
ztest -f /To get an idea of what ztest is actually testing try this:
ztest -f / -VVVMaybe you'd like to run ztest for longer? To do so simply use the -T option and specify the runlength in seconds like so:
ztest -f / -V -T 120"ZFS_HOSTID=id" Use id instead of the SPL hostid to identify this host. Intended for use with ztest, but this environment variable will affect any utility which uses libzpool, including zpool(8). Since the kernel is unaware of this setting results with utilities other than ztest are undefined.
"ZFS_STACK_SIZE=stacksize" Limit the default stack size to stacksize bytes for the purpose of detecting and debugging kernel stack overflows. This value defaults to 32K which is double the default 16K Linux kernel stack size. In practice, setting the stack size slightly higher is needed because differences in stack usage between kernel and user space can lead to spurious stack overflows (especially when debugging is enabled). The specified value will be rounded up to a floor of PTHREAD_STACK_MIN which is the minimum stack required for a NULL procedure in user space. By default the stack size is limited to 256K.