mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-30 21:09:38 +03:00
5caeef02fa
This feature allows disks to be added one at a time to a RAID-Z group, expanding its capacity incrementally. This feature is especially useful for small pools (typically with only one RAID-Z group), where there isn't sufficient hardware to add capacity by adding a whole new RAID-Z group (typically doubling the number of disks). == Initiating expansion == A new device (disk) can be attached to an existing RAIDZ vdev, by running `zpool attach POOL raidzP-N NEW_DEVICE`, e.g. `zpool attach tank raidz2-0 sda`. The new device will become part of the RAIDZ group. A "raidz expansion" will be initiated, and the new device will contribute additional space to the RAIDZ group once the expansion completes. The `feature@raidz_expansion` on-disk feature flag must be `enabled` to initiate an expansion, and it remains `active` for the life of the pool. In other words, pools with expanded RAIDZ vdevs can not be imported by older releases of the ZFS software. == During expansion == The expansion entails reading all allocated space from existing disks in the RAIDZ group, and rewriting it to the new disks in the RAIDZ group (including the newly added device). The expansion progress can be monitored with `zpool status`. Data redundancy is maintained during (and after) the expansion. If a disk fails while the expansion is in progress, the expansion pauses until the health of the RAIDZ vdev is restored (e.g. by replacing the failed disk and waiting for reconstruction to complete). The pool remains accessible during expansion. Following a reboot or export/import, the expansion resumes where it left off. == After expansion == When the expansion completes, the additional space is available for use, and is reflected in the `available` zfs property (as seen in `zfs list`, `df`, etc). Expansion does not change the number of failures that can be tolerated without data loss (e.g. a RAIDZ2 is still a RAIDZ2 even after expansion). A RAIDZ vdev can be expanded multiple times. After the expansion completes, old blocks remain with their old data-to-parity ratio (e.g. 5-wide RAIDZ2, has 3 data to 2 parity), but distributed among the larger set of disks. New blocks will be written with the new data-to-parity ratio (e.g. a 5-wide RAIDZ2 which has been expanded once to 6-wide, has 4 data to 2 parity). However, the RAIDZ vdev's "assumed parity ratio" does not change, so slightly less space than is expected may be reported for newly-written blocks, according to `zfs list`, `df`, `ls -s`, and similar tools. Sponsored-by: The FreeBSD Foundation Sponsored-by: iXsystems, Inc. Sponsored-by: vStack Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Mark Maybee <mark.maybee@delphix.com> Authored-by: Matthew Ahrens <mahrens@delphix.com> Contributions-by: Fedor Uporov <fuporov.vstack@gmail.com> Contributions-by: Stuart Maybee <stuart.maybee@comcast.net> Contributions-by: Thorsten Behrens <tbehrens@outlook.com> Contributions-by: Fmstrat <nospam@nowsci.com> Contributions-by: Don Brady <dev.fs.zfs@gmail.com> Signed-off-by: Don Brady <dev.fs.zfs@gmail.com> Closes #15022
263 lines
7.1 KiB
Groff
263 lines
7.1 KiB
Groff
.\"
|
|
.\" 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 https://opensource.org/licenses/CDDL-1.0.
|
|
.\" 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.
|
|
.\"
|
|
.Dd May 26, 2021
|
|
.Dt ZTEST 1
|
|
.Os
|
|
.
|
|
.Sh NAME
|
|
.Nm ztest
|
|
.Nd was written by the ZFS Developers as a ZFS unit test
|
|
.Sh SYNOPSIS
|
|
.Nm
|
|
.Op Fl VEG
|
|
.Op Fl v Ar vdevs
|
|
.Op Fl s Ar size_of_each_vdev
|
|
.Op Fl a Ar alignment_shift
|
|
.Op Fl m Ar mirror_copies
|
|
.Op Fl r Ar raidz_disks/draid_disks
|
|
.Op Fl R Ar raid_parity
|
|
.Op Fl K Ar raid_kind
|
|
.Op Fl D Ar draid_data
|
|
.Op Fl S Ar draid_spares
|
|
.Op Fl C Ar vdev_class_state
|
|
.Op Fl d Ar datasets
|
|
.Op Fl t Ar threads
|
|
.Op Fl g Ar gang_block_threshold
|
|
.Op Fl i Ar initialize_pool_i_times
|
|
.Op Fl k Ar kill_percentage
|
|
.Op Fl p Ar pool_name
|
|
.Op Fl T Ar time
|
|
.Op Fl z Ar zil_failure_rate
|
|
.
|
|
.Nm
|
|
.Fl X
|
|
.Op Fl VG
|
|
.Op Fl s Ar size_of_each_vdev
|
|
.Op Fl a Ar alignment_shift
|
|
.Op Fl r Ar raidz_disks
|
|
.Op Fl R Ar raid_parity
|
|
.Op Fl d Ar datasets
|
|
.Op Fl t Ar threads
|
|
.
|
|
.Sh DESCRIPTION
|
|
.Nm
|
|
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
|
|
.Nm .
|
|
In addition, a separate test development team wrote and
|
|
executed more functional and stress tests.
|
|
.
|
|
.Pp
|
|
By default
|
|
.Nm
|
|
runs for ten minutes and uses block files
|
|
(stored in
|
|
.Pa /tmp )
|
|
to create pools rather than using physical disks.
|
|
Block files afford
|
|
.Nm
|
|
its flexibility to play around with
|
|
zpool components without requiring large hardware configurations.
|
|
However, storing the block files in
|
|
.Pa /tmp
|
|
may not work for you if you
|
|
have a small tmp directory.
|
|
.
|
|
.Pp
|
|
By default is non-verbose.
|
|
This is why entering the command above will result in
|
|
.Nm
|
|
quietly executing for 5 minutes.
|
|
The
|
|
.Fl V
|
|
option can be used to increase the verbosity of the tool.
|
|
Adding multiple
|
|
.Fl V
|
|
options is allowed and the more you add the more chatty
|
|
.Nm
|
|
becomes.
|
|
.
|
|
.Pp
|
|
After the
|
|
.Nm
|
|
run completes, you should notice many
|
|
.Pa 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
|
|
.Nm
|
|
run by using the
|
|
.Fl E
|
|
option.
|
|
.
|
|
.Sh OPTIONS
|
|
.Bl -tag -width "-v v"
|
|
.It Fl h , \&? , -help
|
|
Print a help summary.
|
|
.It Fl v , -vdevs Ns = (default: Sy 5 )
|
|
Number of vdevs.
|
|
.It Fl s , -vdev-size Ns = (default: Sy 64M )
|
|
Size of each vdev.
|
|
.It Fl a , -alignment-shift Ns = (default: Sy 9 ) No (use Sy 0 No for random )
|
|
Alignment shift used in test.
|
|
.It Fl m , -mirror-copies Ns = (default: Sy 2 )
|
|
Number of mirror copies.
|
|
.It Fl r , -raid-disks Ns = (default: Sy 4 No for raidz/ Ns Sy 16 No for draid )
|
|
Number of raidz/draid disks.
|
|
.It Fl R , -raid-parity Ns = (default: Sy 1 )
|
|
Raid parity (raidz & draid).
|
|
.It Xo
|
|
.Fl K , -raid-kind Ns = Ns
|
|
.Sy raidz Ns | Ns Sy eraidz Ns | Ns Sy draid Ns | Ns Sy random
|
|
(default:
|
|
.Sy random Ns
|
|
)
|
|
.Xc
|
|
The kind of RAID config to use.
|
|
With
|
|
.Sy random
|
|
the kind alternates between raidz, eraidz (expandable raidz) and draid.
|
|
.It Fl D , -draid-data Ns = (default: Sy 4 )
|
|
Number of data disks in a dRAID redundancy group.
|
|
.It Fl S , -draid-spares Ns = (default: Sy 1 )
|
|
Number of dRAID distributed spare disks.
|
|
.It Fl d , -datasets Ns = (default: Sy 7 )
|
|
Number of datasets.
|
|
.It Fl t , -threads Ns = (default: Sy 23 )
|
|
Number of threads.
|
|
.It Fl g , -gang-block-threshold Ns = (default: Sy 32K )
|
|
Gang block threshold.
|
|
.It Fl i , -init-count Ns = (default: Sy 1 )
|
|
Number of pool initializations.
|
|
.It Fl k , -kill-percentage Ns = (default: Sy 70% )
|
|
Kill percentage.
|
|
.It Fl p , -pool-name Ns = (default: Sy ztest )
|
|
Pool name.
|
|
.It Fl f , -vdev-file-directory Ns = (default: Pa /tmp )
|
|
File directory for vdev files.
|
|
.It Fl M , -multi-host
|
|
Multi-host; simulate pool imported on remote host.
|
|
.It Fl E , -use-existing-pool
|
|
Use existing pool (use existing pool instead of creating new one).
|
|
.It Fl T , -run-time Ns = (default: Sy 300 Ns s)
|
|
Total test run time.
|
|
.It Fl P , -pass-time Ns = (default: Sy 60 Ns s)
|
|
Time per pass.
|
|
.It Fl F , -freeze-loops Ns = (default: Sy 50 )
|
|
Max loops in
|
|
.Fn spa_freeze .
|
|
.It Fl B , -alt-ztest Ns =
|
|
Path to alternate ("older")
|
|
.Nm ztest
|
|
to drive, which will be used to initialise the pool, and, a stochastic half the
|
|
time, to run the tests.
|
|
The parallel
|
|
.Pa lib
|
|
directory is prepended to
|
|
.Ev LD_LIBRARY_PATH ;
|
|
i.e. given
|
|
.Fl B Pa ./chroots/lenny/usr/bin/ Ns Nm ,
|
|
.Pa ./chroots/lenny/usr/lib
|
|
will be loaded.
|
|
.It Fl C , -vdev-class-state Ns = Ns Sy on Ns | Ns Sy off Ns | Ns Sy random No (default : Sy random )
|
|
The vdev allocation class state.
|
|
.It Fl o , -option Ns = Ns Ar variable Ns = Ns Ar value
|
|
Set global
|
|
.Ar variable
|
|
to an unsigned 32-bit integer
|
|
.Ar value
|
|
(little-endian only).
|
|
.It Fl G , -dump-debug
|
|
Dump zfs_dbgmsg buffer before exiting due to an error.
|
|
.It Fl V , -verbose
|
|
Verbose (use multiple times for ever more verbosity).
|
|
.It Fl X , -raidz-expansion
|
|
Perform a dedicated raidz expansion test.
|
|
.El
|
|
.
|
|
.Sh EXAMPLES
|
|
To override
|
|
.Pa /tmp
|
|
as your location for block files, you can use the
|
|
.Fl f
|
|
option:
|
|
.Dl # ztest -f /
|
|
.Pp
|
|
To get an idea of what
|
|
.Nm
|
|
is actually testing try this:
|
|
.Dl # ztest -f / -VVV
|
|
.Pp
|
|
Maybe you'd like to run
|
|
.Nm ztest
|
|
for longer? To do so simply use the
|
|
.Fl T
|
|
option and specify the runlength in seconds like so:
|
|
.Dl # ztest -f / -V -T 120
|
|
.
|
|
.Sh ENVIRONMENT VARIABLES
|
|
.Bl -tag -width "ZF"
|
|
.It Ev ZFS_HOSTID Ns = Ns Em id
|
|
Use
|
|
.Em id
|
|
instead of the SPL hostid to identify this host.
|
|
Intended for use with
|
|
.Nm , but this environment variable will affect any utility which uses
|
|
libzpool, including
|
|
.Xr zpool 8 .
|
|
Since the kernel is unaware of this setting,
|
|
results with utilities other than ztest are undefined.
|
|
.It Ev ZFS_STACK_SIZE Ns = Ns Em stacksize
|
|
Limit the default stack size to
|
|
.Em stacksize
|
|
bytes for the purpose of
|
|
detecting and debugging kernel stack overflows.
|
|
This value defaults to
|
|
.Em 32K
|
|
which is double the default
|
|
.Em 16K
|
|
Linux kernel stack size.
|
|
.Pp
|
|
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.
|
|
.Pp
|
|
By default the stack size is limited to
|
|
.Em 256K .
|
|
.El
|
|
.
|
|
.Sh SEE ALSO
|
|
.Xr zdb 1 ,
|
|
.Xr zfs 1 ,
|
|
.Xr zpool 1 ,
|
|
.Xr spl 4
|