zpool/zfs: Add '-a|--all' option to scrub, trim, initialize

Add support for the '-a | --all' option to perform trim,
scrub, and initialize operations on all pools.
Previously, specifying a pool name was mandatory for
these operations. With this enhancement, users can now
execute these operations across all pools at once,
without needing to manually iterate over each pool
from the command line.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: Akash B <akash-b@hpe.com>
Closes #17524
This commit is contained in:
Akash B
2025-07-30 03:20:44 +05:30
committed by GitHub
parent fc885f308f
commit b6e8db509d
15 changed files with 637 additions and 104 deletions
+6 -1
View File
@@ -26,6 +26,7 @@
.\" Copyright (c) 2018 George Melikov. All Rights Reserved.
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\" Copyright (c) 2025 Hewlett Packard Enterprise Development LP.
.\"
.Dd May 27, 2021
.Dt ZPOOL-INITIALIZE 8
@@ -39,7 +40,7 @@
.Cm initialize
.Op Fl c Ns | Ns Fl s | Ns Fl u
.Op Fl w
.Ar pool
.Fl a Ns | Ns Ar pool
.Oo Ar device Oc Ns …
.
.Sh DESCRIPTION
@@ -48,6 +49,10 @@ devices, or all eligible devices in the pool if no individual devices are
specified.
Only leaf data or log devices may be initialized.
.Bl -tag -width Ds
.It Fl a , -all
Begin, cancel, suspend initializing on
all
pools.
.It Fl c , -cancel
Cancel initializing on the specified devices, or all eligible devices if none
are specified.
+8 -1
View File
@@ -26,6 +26,7 @@
.\" Copyright (c) 2018, 2021 George Melikov. All Rights Reserved.
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\" Copyright (c) 2025 Hewlett Packard Enterprise Development LP.
.\"
.Dd November 18, 2024
.Dt ZPOOL-SCRUB 8
@@ -39,7 +40,7 @@
.Cm scrub
.Op Ns Fl e | Ns Fl p | Fl s Ns | Fl C Ns
.Op Fl w
.Ar pool Ns …
.Fl a Ns | Ns Ar pool Ns …
.
.Sh DESCRIPTION
Begins a scrub or resumes a paused scrub.
@@ -89,6 +90,12 @@ During this period, no completion time estimate will be provided.
.
.Sh OPTIONS
.Bl -tag -width "-s"
.It Fl a , -all
Begin, pause, stop scrub on
all
pools.
Initiating scrubs on multiple pools can put considerable load and memory
pressure on the system, so this operation should be performed with caution.
.It Fl s
Stop scrubbing.
.It Fl p
+6 -1
View File
@@ -26,6 +26,7 @@
.\" Copyright (c) 2018 George Melikov. All Rights Reserved.
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\" Copyright (c) 2025 Hewlett Packard Enterprise Development LP.
.\"
.Dd May 27, 2021
.Dt ZPOOL-TRIM 8
@@ -40,7 +41,7 @@
.Op Fl dw
.Op Fl r Ar rate
.Op Fl c Ns | Ns Fl s
.Ar pool
.Fl a Ns | Ns Ar pool
.Oo Ar device Ns Oc Ns …
.
.Sh DESCRIPTION
@@ -57,6 +58,10 @@ See the documentation for the
.Sy autotrim
property above for the types of vdev devices which can be trimmed.
.Bl -tag -width Ds
.It Fl a , -all
Perform TRIM operation on
all
pools.
.It Fl d , -secure
Causes a secure TRIM to be initiated.
When performing a secure TRIM, the