4 .\" The contents of this file are subject to the terms of the
5 .\" Common Development and Distribution License (the "License").
6 .\" You may not use this file except in compliance with the License.
8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 .\" or https://opensource.org/licenses/CDDL-1.0.
10 .\" See the License for the specific language governing permissions
11 .\" and limitations under the License.
13 .\" When distributing Covered Code, include this CDDL HEADER in each
14 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 .\" If applicable, add the following below this CDDL HEADER, with the
16 .\" fields enclosed by brackets "[]" replaced with your own identifying
17 .\" information: Portions Copyright [yyyy] [name of copyright owner]
21 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
22 .\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
23 .\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
24 .\" Copyright (c) 2017 Datto Inc.
25 .\" Copyright (c) 2018, 2021 George Melikov. All Rights Reserved.
26 .\" Copyright 2017 Nexenta Systems, Inc.
27 .\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
35 .Nd begin or resume scrub of ZFS storage pools
45 Begins a scrub or resumes a paused scrub.
46 The scrub examines all data in the specified pools to verify that it checksums
49 .Pq mirror, raidz, or draid
50 devices, ZFS automatically repairs any damage discovered during the scrub.
53 command reports the progress of the scrub and summarizes the results of the
54 scrub upon completion.
56 Scrubbing and resilvering are very similar operations.
57 The difference is that resilvering only examines data that ZFS knows to be out
60 for example, when attaching a new device to a mirror or replacing an existing
63 whereas scrubbing examines all data to discover silent errors due to hardware
64 faults or disk failure.
66 When scrubbing a pool with encrypted filesystems the keys do not need to be
68 However, if the keys are not loaded and an unrepairable checksum error is
69 detected the file name cannot be included in the
70 .Nm zpool Cm status Fl v
73 Because scrubbing and resilvering are I/O-intensive operations, ZFS only allows
76 A scrub is split into two parts: metadata scanning and block scrubbing.
77 The metadata scanning sorts blocks into large sequential ranges which can then
78 be read much more efficiently from disk when issuing the scrub I/O.
80 If a scrub is paused, the
83 If a resilver is in progress, ZFS does not allow a scrub to be started until the
86 Note that, due to changes in pool data on a live system, it is possible for
87 scrubs to progress slightly beyond 100% completion.
88 During this period, no completion time estimate will be provided.
96 Scrub pause state and progress are periodically synced to disk.
97 If the system is restarted or pool is exported during a paused scrub,
98 even after import, scrub will remain paused until it is resumed.
99 Once resumed the scrub will pick up from the place where it was last
100 checkpointed to disk.
101 To resume a paused scrub issue
108 Wait until scrub has completed before returning.
110 Only scrub files with known data errors as reported by
111 .Nm zpool Cm status Fl v .
112 The pool must have been scrubbed at least once with the
114 feature enabled to use this option.
115 Error scrubbing cannot be run simultaneously with regular scrubbing or
116 resilvering, nor can it be run when a regular scrub is paused.
120 Status of pool with ongoing scrub:
122 .Bd -literal -compact
123 .No # Nm zpool Cm status
125 scan: scrub in progress since Sun Jul 25 16:07:49 2021
126 403M / 405M scanned at 100M/s, 68.4M / 405M issued at 10.0M/s
127 0B repaired, 16.91% done, 00:00:04 to go
131 Where metadata which references 403M of file data has been
132 scanned at 100M/s, and 68.4M of that file data has been
133 scrubbed sequentially at 10.0M/s.
135 On machines using systemd, scrub timers can be enabled on per-pool basis.
139 timer units are provided.
145 .Cm zfs-scrub-\fIweekly\fB@\fIrpool\fB.timer
151 .Cm zfs-scrub-\fImonthly\fB@\fIotherpool\fB.timer
156 .Xr systemd.timer 5 ,
158 .Xr zpool-resilver 8 ,