xref: /freebsd/sys/contrib/openzfs/man/man8/zpool-scrub.8 (revision e92ffd9b626833ebdbf2742c8ffddc6cd94b963e)
1eda14cbcSMatt Macy.\"
2eda14cbcSMatt Macy.\" CDDL HEADER START
3eda14cbcSMatt Macy.\"
4eda14cbcSMatt Macy.\" The contents of this file are subject to the terms of the
5eda14cbcSMatt Macy.\" Common Development and Distribution License (the "License").
6eda14cbcSMatt Macy.\" You may not use this file except in compliance with the License.
7eda14cbcSMatt Macy.\"
8eda14cbcSMatt Macy.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9eda14cbcSMatt Macy.\" or http://www.opensolaris.org/os/licensing.
10eda14cbcSMatt Macy.\" See the License for the specific language governing permissions
11eda14cbcSMatt Macy.\" and limitations under the License.
12eda14cbcSMatt Macy.\"
13eda14cbcSMatt Macy.\" When distributing Covered Code, include this CDDL HEADER in each
14eda14cbcSMatt Macy.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15eda14cbcSMatt Macy.\" If applicable, add the following below this CDDL HEADER, with the
16eda14cbcSMatt Macy.\" fields enclosed by brackets "[]" replaced with your own identifying
17eda14cbcSMatt Macy.\" information: Portions Copyright [yyyy] [name of copyright owner]
18eda14cbcSMatt Macy.\"
19eda14cbcSMatt Macy.\" CDDL HEADER END
20eda14cbcSMatt Macy.\"
21eda14cbcSMatt Macy.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
22eda14cbcSMatt Macy.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
23eda14cbcSMatt Macy.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
24eda14cbcSMatt Macy.\" Copyright (c) 2017 Datto Inc.
251f88aa09SMartin Matuska.\" Copyright (c) 2018, 2021 George Melikov. All Rights Reserved.
26eda14cbcSMatt Macy.\" Copyright 2017 Nexenta Systems, Inc.
27eda14cbcSMatt Macy.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
28eda14cbcSMatt Macy.\"
291f88aa09SMartin Matuska.Dd July 25, 2021
30eda14cbcSMatt Macy.Dt ZPOOL-SCRUB 8
31eda14cbcSMatt Macy.Os
3216038816SMartin Matuska.
33eda14cbcSMatt Macy.Sh NAME
347877fdebSMatt Macy.Nm zpool-scrub
3516038816SMartin Matuska.Nd begin or resume scrub of ZFS storage pools
36eda14cbcSMatt Macy.Sh SYNOPSIS
377877fdebSMatt Macy.Nm zpool
38eda14cbcSMatt Macy.Cm scrub
3916038816SMartin Matuska.Op Fl s Ns | Ns Fl p
40eda14cbcSMatt Macy.Op Fl w
4116038816SMartin Matuska.Ar pool Ns …
4216038816SMartin Matuska.
43eda14cbcSMatt Macy.Sh DESCRIPTION
44eda14cbcSMatt MacyBegins a scrub or resumes a paused scrub.
45eda14cbcSMatt MacyThe scrub examines all data in the specified pools to verify that it checksums
46eda14cbcSMatt Macycorrectly.
47eda14cbcSMatt MacyFor replicated
487877fdebSMatt Macy.Pq mirror, raidz, or draid
49eda14cbcSMatt Macydevices, ZFS automatically repairs any damage discovered during the scrub.
50eda14cbcSMatt MacyThe
51eda14cbcSMatt Macy.Nm zpool Cm status
52eda14cbcSMatt Macycommand reports the progress of the scrub and summarizes the results of the
53eda14cbcSMatt Macyscrub upon completion.
54eda14cbcSMatt Macy.Pp
55eda14cbcSMatt MacyScrubbing and resilvering are very similar operations.
56eda14cbcSMatt MacyThe difference is that resilvering only examines data that ZFS knows to be out
57eda14cbcSMatt Macyof date
58eda14cbcSMatt Macy.Po
59eda14cbcSMatt Macyfor example, when attaching a new device to a mirror or replacing an existing
60eda14cbcSMatt Macydevice
61eda14cbcSMatt Macy.Pc ,
62eda14cbcSMatt Macywhereas scrubbing examines all data to discover silent errors due to hardware
63eda14cbcSMatt Macyfaults or disk failure.
64eda14cbcSMatt Macy.Pp
65eda14cbcSMatt MacyBecause scrubbing and resilvering are I/O-intensive operations, ZFS only allows
66eda14cbcSMatt Macyone at a time.
671f88aa09SMartin Matuska.Pp
681f88aa09SMartin MatuskaA scrub is split into two parts: metadata scanning and block scrubbing.
691f88aa09SMartin MatuskaThe metadata scanning sorts blocks into large sequential ranges which can then
701f88aa09SMartin Matuskabe read much more efficiently from disk when issuing the scrub I/O.
711f88aa09SMartin Matuska.Pp
72eda14cbcSMatt MacyIf a scrub is paused, the
73eda14cbcSMatt Macy.Nm zpool Cm scrub
74eda14cbcSMatt Macyresumes it.
75eda14cbcSMatt MacyIf a resilver is in progress, ZFS does not allow a scrub to be started until the
76eda14cbcSMatt Macyresilver completes.
77eda14cbcSMatt Macy.Pp
78eda14cbcSMatt MacyNote that, due to changes in pool data on a live system, it is possible for
7916038816SMartin Matuskascrubs to progress slightly beyond 100% completion.
8016038816SMartin MatuskaDuring this period, no completion time estimate will be provided.
8116038816SMartin Matuska.
8216038816SMartin Matuska.Sh OPTIONS
8316038816SMartin Matuska.Bl -tag -width "-s"
84eda14cbcSMatt Macy.It Fl s
85eda14cbcSMatt MacyStop scrubbing.
86eda14cbcSMatt Macy.It Fl p
87eda14cbcSMatt MacyPause scrubbing.
88eda14cbcSMatt MacyScrub pause state and progress are periodically synced to disk.
89eda14cbcSMatt MacyIf the system is restarted or pool is exported during a paused scrub,
90eda14cbcSMatt Macyeven after import, scrub will remain paused until it is resumed.
91eda14cbcSMatt MacyOnce resumed the scrub will pick up from the place where it was last
92eda14cbcSMatt Macycheckpointed to disk.
93eda14cbcSMatt MacyTo resume a paused scrub issue
94eda14cbcSMatt Macy.Nm zpool Cm scrub
95eda14cbcSMatt Macyagain.
96eda14cbcSMatt Macy.It Fl w
97eda14cbcSMatt MacyWait until scrub has completed before returning.
98eda14cbcSMatt Macy.El
991f88aa09SMartin Matuska.Sh EXAMPLES
1001f88aa09SMartin Matuska.Bl -tag -width "Exam"
1011f88aa09SMartin Matuska.It Sy Example 1 : Status of pool with ongoing scrub:
1021f88aa09SMartin MatuskaOutput:
1031f88aa09SMartin Matuska.Bd -literal -compact -offset Ds
1041f88aa09SMartin Matuska.No # Nm zpool Cm status
1051f88aa09SMartin Matuska  ...
1061f88aa09SMartin Matuska  scan: scrub in progress since Sun Jul 25 16:07:49 2021
1071f88aa09SMartin Matuska        403M scanned at 100M/s, 68.4M issued at 10.0M/s, 405M total
1081f88aa09SMartin Matuska        0B repaired, 16.91% done, 00:00:04 to go
1091f88aa09SMartin Matuska  ...
1101f88aa09SMartin Matuska.Ed
1111f88aa09SMartin MatuskaWhere:
1121f88aa09SMartin Matuska.Bl -dash -offset indent
1131f88aa09SMartin Matuska.It
1141f88aa09SMartin MatuskaMetadata which references 403M of file data has been
1151f88aa09SMartin Matuskascanned at 100M/s, and 68.4M of that file data has been
1161f88aa09SMartin Matuskascrubbed sequentially at 10.0M/s.
1171f88aa09SMartin Matuska.El
1181f88aa09SMartin Matuska.El
119*e92ffd9bSMartin Matuska.Sh PERIODIC SCRUB
120*e92ffd9bSMartin MatuskaOn machines using systemd, scrub timers can be enabled on per-pool basis.
121*e92ffd9bSMartin Matuska.Nm weekly
122*e92ffd9bSMartin Matuskaand
123*e92ffd9bSMartin Matuska.Nm monthly
124*e92ffd9bSMartin Matuskatimer units are provided.
125*e92ffd9bSMartin Matuska.Bl -tag -width Ds
126*e92ffd9bSMartin Matuska.It Xo
127*e92ffd9bSMartin Matuska.Xc
128*e92ffd9bSMartin Matuska.Nm systemctl
129*e92ffd9bSMartin Matuska.Cm enable
130*e92ffd9bSMartin Matuska.Cm zfs-scrub-\fIweekly\fB@\fIrpool\fB.timer
131*e92ffd9bSMartin Matuska.Cm --now
132*e92ffd9bSMartin Matuska.It Xo
133*e92ffd9bSMartin Matuska.Xc
134*e92ffd9bSMartin Matuska.Nm systemctl
135*e92ffd9bSMartin Matuska.Cm enable
136*e92ffd9bSMartin Matuska.Cm zfs-scrub-\fImonthly\fB@\fIotherpool\fB.timer
137*e92ffd9bSMartin Matuska.Cm --now
138*e92ffd9bSMartin Matuska.El
13916038816SMartin Matuska.
140eda14cbcSMatt Macy.Sh SEE ALSO
141*e92ffd9bSMartin Matuska.Xr systemd.timer 5 ,
142eda14cbcSMatt Macy.Xr zpool-iostat 8 ,
143eda14cbcSMatt Macy.Xr zpool-resilver 8 ,
144eda14cbcSMatt Macy.Xr zpool-status 8
145