Skip to content

Commit

Permalink
MFC r323355: MFV r323107: 8414 Implemented zpool scrub pause/resume
Browse files Browse the repository at this point in the history
illumos/illumos-gate@1702cce
illumos/illumos-gate@1702cce

FreeBSD note:  rather than merging the zpool.8 update I copied the zpool
scrub section from the illumos zpool.1m to FreeBSD zpool.8 almost
verbatim.  Now that the illumos page uses the mdoc format, it was an
easier option.  Perhaps the change is not in perfect compliance with the
FreeBSD style, but I think that it is acceptible.

https://www.illumos.org/issues/8414
  This issue tracks the port of scrub pause from ZoL: openzfs/zfs#6167
  Currently, there is no way to pause a scrub. Pausing may be useful when
  the pool is busy with other I/O to preserve bandwidth.

  Description

  This patch adds the ability to pause and resume scrubbing.  This is achieved
  by maintaining a persistent on-disk scrub state.  While the state is 'paused'
  we do not scrub any more blocks.  We do however perform regular scan
  housekeeping such as freeing async destroyed and deadlist blocks while paused.

  Motivation and Context

  Scrub pausing can be an I/O intensive operation and people have been asking
  for the ability to pause a scrub for a while. This allows one to preserve scrub
  progress while freeing up bandwidth for other I/O.

Reviewed by: George Melikov <mail@gmelikov.ru>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Brad Lewis <brad.lewis@delphix.com>
Reviewed by: Serapheim Dimitropoulos <serapheim@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Alek Pinchuk <apinchuk@datto.com>

Former-commit-id: 962ee1895449e77d03e9bdd28a19c016eb222b25
  • Loading branch information
avg-I committed Sep 26, 2017
1 parent 65579b6 commit 1ad2f78
Show file tree
Hide file tree
Showing 14 changed files with 1,087 additions and 89 deletions.
76 changes: 44 additions & 32 deletions cddl/contrib/opensolaris/cmd/zpool/zpool.8
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011, Nexenta Systems, Inc. All Rights Reserved.
.\" Copyright (c) 2011, Justin T. Gibbs <gibbs@FreeBSD.org>
.\" Copyright (c) 2013 by Delphix. All Rights Reserved.
.\" Copyright (c) 2012, Glen Barber <gjb@FreeBSD.org>
.\" Copyright (c) 2013 by Delphix. All Rights Reserved.
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Datto Inc.
.\"
.\" $FreeBSD$
.\"
.Dd July 26, 2014
.Dd September 08, 2017
.Dt ZPOOL 8
.Os
.Sh NAME
Expand Down Expand Up @@ -153,7 +154,7 @@
.Op Ar new_device
.Nm
.Cm scrub
.Op Fl s
.Op Fl s | Fl p
.Ar pool ...
.Nm
.Cm set
Expand Down Expand Up @@ -1543,43 +1544,54 @@ manner.
.It Xo
.Nm
.Cm scrub
.Op Fl s
.Op Fl s | Fl p
.Ar pool ...
.Xc
.Pp
Begins a scrub. The scrub examines all data in the specified pools to verify
that it checksums correctly. For replicated (mirror or
.No raidz )
devices,
.Tn ZFS
automatically repairs any damage discovered during the scrub. The
.Qq Nm Cm status
Begins a scrub or resumes a paused scrub.
The scrub examines all data in the specified pools to verify that it checksums
correctly.
For replicated
.Pq mirror or raidz
devices, ZFS automatically repairs any damage discovered during the scrub.
The
.Nm zpool Cm status
command reports the progress of the scrub and summarizes the results of the
scrub upon completion.
.Pp
Scrubbing and resilvering are very similar operations. The difference is that
resilvering only examines data that
.Tn ZFS
knows to be out of date (for example, when attaching a new device to a mirror
or replacing an existing device), whereas scrubbing examines all data to
discover silent errors due to hardware faults or disk failure.
.Pp
Because scrubbing and resilvering are
.Tn I/O Ns -intensive
operations,
.Tn ZFS
only allows one at a time. If a scrub is already in progress, the
.Qq Nm Cm scrub
command returns an error. To start a new scrub, you have to stop the old scrub
with the
.Qq Nm Cm scrub Fl s
command first. If a resilver is in progress,
.Tn ZFS
does not allow a scrub to be started until the resilver completes.
.Bl -tag -width indent
Scrubbing and resilvering are very similar operations.
The difference is that resilvering only examines data that ZFS knows to be out
of date
.Po
for example, when attaching a new device to a mirror or replacing an existing
device
.Pc ,
whereas scrubbing examines all data to discover silent errors due to hardware
faults or disk failure.
.Pp
Because scrubbing and resilvering are I/O-intensive operations, ZFS only allows
one at a time.
If a scrub is paused, the
.Nm zpool Cm scrub
resumes it.
If a resilver is in progress, ZFS does not allow a scrub to be started until the
resilver completes.
.Bl -tag -width Ds
.It Fl s
Stop scrubbing.
.El
.Bl -tag -width Ds
.It Fl p
Pause scrubbing.
Scrub pause state and progress are periodically synced to disk.
If the system is restarted or pool is exported during a paused scrub,
even after import, scrub will remain paused until it is resumed.
Once resumed the scrub will pick up from the place where it was last
checkpointed to disk.
To resume a paused scrub issue
.Nm zpool Cm scrub
again.
.El
.It Xo
.Nm
.Cm set
Expand Down
Loading

0 comments on commit 1ad2f78

Please sign in to comment.