Add ashift validation when adding devices to a pool

Currently, zpool add allows users to add top-level vdevs that have
different ashifts but doing so prevents users from being able to
perform a top-level vdev removal. Often times consumers may not realize
that they have mismatched ashifts until the top-level removal fails.

This feature adds ashift validation to the zpool add command and will
fail the operation if the sector size of the specified vdev does not
match the existing pool. This behavior can be disabled by using the -f
flag. In addition, new flags have been added to provide fine-grained
control to disable specific checks. These flags
are:

--allow-in-use
--allow-ashift-mismatch
--allow-replicaton-mismatch

The force flag will disable all of these checks.

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Mark Maybee <mmaybee@delphix.com>
Signed-off-by: George Wilson <gwilson@delphix.com>
Closes #15509
This commit is contained in:
George Wilson
2024-03-29 15:15:56 -04:00
committed by GitHub
parent e39e20b6dc
commit b1e46f869e
21 changed files with 219 additions and 58 deletions
+16 -2
View File
@@ -24,8 +24,9 @@
.\" Copyright (c) 2018 George Melikov. All Rights Reserved.
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\" Copyright (c) 2024 by Delphix. All Rights Reserved.
.\"
.Dd March 16, 2022
.Dd March 8, 2024
.Dt ZPOOL-ADD 8
.Os
.
@@ -36,6 +37,7 @@
.Nm zpool
.Cm add
.Op Fl fgLnP
.Op Fl -allow-in-use -allow-replication-mismatch -allow-ashift-mismatch
.Oo Fl o Ar property Ns = Ns Ar value Oc
.Ar pool vdev Ns …
.
@@ -56,7 +58,8 @@ subcommand.
.It Fl f
Forces use of
.Ar vdev Ns s ,
even if they appear in use or specify a conflicting replication level.
even if they appear in use, have conflicting ashift values, or specify
a conflicting replication level.
Not all devices can be overridden in this manner.
.It Fl g
Display
@@ -91,6 +94,17 @@ See the
manual page for a list of valid properties that can be set.
The only property supported at the moment is
.Sy ashift .
.It Fl -allow-ashift-mismatch
Disable the ashift validation which allows mismatched ashift values in the
pool.
Adding top-level
.Ar vdev Ns s
with different sector sizes will prohibit future device removal operations, see
.Xr zpool-remove 8 .
.It Fl -allow-in-use
Allow vdevs to be added even if they might be in use in another pool.
.It Fl -allow-replication-mismatch
Allow vdevs with conflicting replication levels to be added to the pool.
.El
.
.Sh EXAMPLES