ZTEST(1) | General Commands Manual | ZTEST(1) |
ztest
— was
written by the ZFS Developers as a ZFS unit test
ztest |
[-VEG ] [-v
vdevs] [-s
size_of_each_vdev] [-a
alignment_shift] [-m
mirror_copies] [-r
raidz_disks/draid_disks] [-R
raid_parity] [-K
raid_kind] [-D
draid_data] [-S
draid_spares] [-C
vdev_class_state] [-d
datasets] [-t
threads] [-g
gang_block_threshold] [-i
initialize_pool_i_times] [-k
kill_percentage] [-p
pool_name] [-T
time] [-z
zil_failure_rate] |
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
options 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.
-h
,
-?
, --help
-v
,
--vdevs
= (default:
5)-s
,
--vdev-size
= (default:
64M)-a
,
--alignment-shift
= (default:
9)
(use
0
for random)-m
,
--mirror-copies
= (default:
2)-r
,
--raid-disks
= (default: 4
for
raidz/16
for draid)-R
,
--raid-parity
= (default: 1)-K
,
--raid-kind
=raidz|draid|random
(default: random)-D
,
--draid-data
= (default: 4)-S
,
--draid-spares
= (default: 1)-d
,
--datasets
= (default:
7)-t
,
--threads
= (default:
23)-g
,
--gang-block-threshold
= (default:
32K)-i
,
--init-count
= (default: 1)-k
,
--kill-percentage
= (default:
70%)-p
,
--pool-name
= (default:
ztest)-f
,
--vdev-file-directory
= (default:
/tmp)-M
,
--multi-host
-E
,
--use-existing-pool
-T
,
--run-time
= (default:
300s)-P
,
--pass-time
= (default:
60s)-F
,
--freeze-loops
= (default:
50)spa_freeze
().-B
,
--alt-ztest
=-C
,
--vdev-class-state
=on|off|random
(default: random)-o
,
--option
=variable=value-G
,
--dump-debug
-V
,
--verbose
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 / -VVV
Maybe 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
=idztest
, 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
=stacksizeIn 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.
May 26, 2021 | OpenZFS |