]> git.proxmox.com Git - mirror_zfs.git/commit
RAID-Z expansion feature
authorDon Brady <don.brady@delphix.com>
Wed, 8 Nov 2023 18:19:41 +0000 (11:19 -0700)
committerGitHub <noreply@github.com>
Wed, 8 Nov 2023 18:19:41 +0000 (10:19 -0800)
commit5caeef02fa531238b4554afc977533382e43314f
tree71a5e80f437ae81b3225124b98291aa90a0a3a3d
parent9198de8f1079a8bbb837de3e3f8e236777b1375d
RAID-Z expansion feature

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
62 files changed:
cmd/raidz_test/raidz_bench.c
cmd/raidz_test/raidz_test.c
cmd/raidz_test/raidz_test.h
cmd/zdb/zdb.c
cmd/zpool/zpool_main.c
cmd/ztest.c
contrib/pyzfs/libzfs_core/_constants.py
contrib/pyzfs/libzfs_core/_error_translation.py
contrib/pyzfs/libzfs_core/exceptions.py
include/libzfs.h
include/sys/fs/zfs.h
include/sys/spa_impl.h
include/sys/uberblock_impl.h
include/sys/vdev.h
include/sys/vdev_impl.h
include/sys/vdev_raidz.h
include/sys/vdev_raidz_impl.h
include/sys/zfs_debug.h
include/zfeature_common.h
lib/libzfs/libzfs.abi
lib/libzfs/libzfs_pool.c
lib/libzfs/libzfs_util.c
lib/libzfs_core/libzfs_core.abi
lib/libzpool/Makefile.am
man/man1/ztest.1
man/man4/zfs.4
man/man7/zpool-features.7
man/man8/zpool-attach.8
man/man8/zpool-wait.8
module/Kbuild.in
module/os/freebsd/zfs/vdev_label_os.c
module/os/linux/zfs/vdev_label_os.c [new file with mode: 0644]
module/os/linux/zfs/zfs_debug.c
module/zcommon/zfeature_common.c
module/zcommon/zpool_prop.c
module/zfs/arc.c
module/zfs/dsl_scan.c
module/zfs/metaslab.c
module/zfs/spa.c
module/zfs/spa_checkpoint.c
module/zfs/vdev.c
module/zfs/vdev_draid.c
module/zfs/vdev_initialize.c
module/zfs/vdev_label.c
module/zfs/vdev_raidz.c
module/zfs/vdev_trim.c
scripts/zloop.sh
tests/runfiles/common.run
tests/zfs-tests/include/tunables.cfg
tests/zfs-tests/tests/Makefile.am
tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg
tests/zfs-tests/tests/functional/raidz/raidz_002_pos.ksh
tests/zfs-tests/tests/functional/raidz/raidz_003_pos.ksh [deleted file]
tests/zfs-tests/tests/functional/raidz/raidz_004_pos.ksh [deleted file]
tests/zfs-tests/tests/functional/raidz/raidz_expand_001_pos.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/raidz/raidz_expand_002_pos.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/raidz/raidz_expand_003_neg.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/raidz/raidz_expand_003_pos.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/raidz/raidz_expand_004_pos.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/raidz/raidz_expand_005_pos.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/raidz/raidz_expand_006_neg.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/raidz/raidz_expand_007_neg.ksh [new file with mode: 0755]