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 9271171e0SMartin Matuska.\" or https://opensource.org/licenses/CDDL-1.0. 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.\" 29*17aab35aSMartin Matuska.Dd November 18, 2024 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 39*17aab35aSMartin Matuska.Op Ns Fl e | Ns Fl p | Fl s Ns | Fl C Ns 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 65c0a83fe0SMartin MatuskaWhen scrubbing a pool with encrypted filesystems the keys do not need to be 66c0a83fe0SMartin Matuskaloaded. 67c0a83fe0SMartin MatuskaHowever, if the keys are not loaded and an unrepairable checksum error is 68c0a83fe0SMartin Matuskadetected the file name cannot be included in the 69c0a83fe0SMartin Matuska.Nm zpool Cm status Fl v 70c0a83fe0SMartin Matuskaverbose error report. 71c0a83fe0SMartin Matuska.Pp 72eda14cbcSMatt MacyBecause scrubbing and resilvering are I/O-intensive operations, ZFS only allows 73eda14cbcSMatt Macyone at a time. 741f88aa09SMartin Matuska.Pp 751f88aa09SMartin MatuskaA scrub is split into two parts: metadata scanning and block scrubbing. 761f88aa09SMartin MatuskaThe metadata scanning sorts blocks into large sequential ranges which can then 771f88aa09SMartin Matuskabe read much more efficiently from disk when issuing the scrub I/O. 781f88aa09SMartin Matuska.Pp 79eda14cbcSMatt MacyIf a scrub is paused, the 80eda14cbcSMatt Macy.Nm zpool Cm scrub 81eda14cbcSMatt Macyresumes it. 82eda14cbcSMatt MacyIf a resilver is in progress, ZFS does not allow a scrub to be started until the 83eda14cbcSMatt Macyresilver completes. 84eda14cbcSMatt Macy.Pp 85eda14cbcSMatt MacyNote that, due to changes in pool data on a live system, it is possible for 8616038816SMartin Matuskascrubs to progress slightly beyond 100% completion. 8716038816SMartin MatuskaDuring this period, no completion time estimate will be provided. 8816038816SMartin Matuska. 8916038816SMartin Matuska.Sh OPTIONS 9016038816SMartin Matuska.Bl -tag -width "-s" 91eda14cbcSMatt Macy.It Fl s 92eda14cbcSMatt MacyStop scrubbing. 93eda14cbcSMatt Macy.It Fl p 94eda14cbcSMatt MacyPause scrubbing. 95eda14cbcSMatt MacyScrub pause state and progress are periodically synced to disk. 96eda14cbcSMatt MacyIf the system is restarted or pool is exported during a paused scrub, 97eda14cbcSMatt Macyeven after import, scrub will remain paused until it is resumed. 98eda14cbcSMatt MacyOnce resumed the scrub will pick up from the place where it was last 99eda14cbcSMatt Macycheckpointed to disk. 100eda14cbcSMatt MacyTo resume a paused scrub issue 101eda14cbcSMatt Macy.Nm zpool Cm scrub 102c0a83fe0SMartin Matuskaor 103c0a83fe0SMartin Matuska.Nm zpool Cm scrub 104c0a83fe0SMartin Matuska.Fl e 105eda14cbcSMatt Macyagain. 106eda14cbcSMatt Macy.It Fl w 107eda14cbcSMatt MacyWait until scrub has completed before returning. 108c0a83fe0SMartin Matuska.It Fl e 109c0a83fe0SMartin MatuskaOnly scrub files with known data errors as reported by 110c0a83fe0SMartin Matuska.Nm zpool Cm status Fl v . 111c0a83fe0SMartin MatuskaThe pool must have been scrubbed at least once with the 112c0a83fe0SMartin Matuska.Sy head_errlog 113c0a83fe0SMartin Matuskafeature enabled to use this option. 114c0a83fe0SMartin MatuskaError scrubbing cannot be run simultaneously with regular scrubbing or 115c0a83fe0SMartin Matuskaresilvering, nor can it be run when a regular scrub is paused. 116*17aab35aSMartin Matuska.It Fl C 117*17aab35aSMartin MatuskaContinue scrub from last saved txg (see zpool 118*17aab35aSMartin Matuska.Sy last_scrubbed_txg 119*17aab35aSMartin Matuskaproperty). 120eda14cbcSMatt Macy.El 1211f88aa09SMartin Matuska.Sh EXAMPLES 122bb2d13b6SMartin Matuska.Ss Example 1 123bb2d13b6SMartin MatuskaStatus of pool with ongoing scrub: 124bb2d13b6SMartin Matuska.sp 125da5137abSMartin Matuska.Bd -literal -compact 1261f88aa09SMartin Matuska.No # Nm zpool Cm status 1271f88aa09SMartin Matuska ... 1281f88aa09SMartin Matuska scan: scrub in progress since Sun Jul 25 16:07:49 2021 1290a97523dSMartin Matuska 403M / 405M scanned at 100M/s, 68.4M / 405M issued at 10.0M/s 1301f88aa09SMartin Matuska 0B repaired, 16.91% done, 00:00:04 to go 1311f88aa09SMartin Matuska ... 1321f88aa09SMartin Matuska.Ed 133da5137abSMartin Matuska.Pp 134da5137abSMartin MatuskaWhere metadata which references 403M of file data has been 1351f88aa09SMartin Matuskascanned at 100M/s, and 68.4M of that file data has been 1361f88aa09SMartin Matuskascrubbed sequentially at 10.0M/s. 137e92ffd9bSMartin Matuska.Sh PERIODIC SCRUB 138e92ffd9bSMartin MatuskaOn machines using systemd, scrub timers can be enabled on per-pool basis. 139e92ffd9bSMartin Matuska.Nm weekly 140e92ffd9bSMartin Matuskaand 141e92ffd9bSMartin Matuska.Nm monthly 142e92ffd9bSMartin Matuskatimer units are provided. 143e92ffd9bSMartin Matuska.Bl -tag -width Ds 144e92ffd9bSMartin Matuska.It Xo 145e92ffd9bSMartin Matuska.Xc 146e92ffd9bSMartin Matuska.Nm systemctl 147e92ffd9bSMartin Matuska.Cm enable 148e92ffd9bSMartin Matuska.Cm zfs-scrub-\fIweekly\fB@\fIrpool\fB.timer 149e92ffd9bSMartin Matuska.Cm --now 150e92ffd9bSMartin Matuska.It Xo 151e92ffd9bSMartin Matuska.Xc 152e92ffd9bSMartin Matuska.Nm systemctl 153e92ffd9bSMartin Matuska.Cm enable 154e92ffd9bSMartin Matuska.Cm zfs-scrub-\fImonthly\fB@\fIotherpool\fB.timer 155e92ffd9bSMartin Matuska.Cm --now 156e92ffd9bSMartin Matuska.El 15716038816SMartin Matuska. 158eda14cbcSMatt Macy.Sh SEE ALSO 159e92ffd9bSMartin Matuska.Xr systemd.timer 5 , 160eda14cbcSMatt Macy.Xr zpool-iostat 8 , 161eda14cbcSMatt Macy.Xr zpool-resilver 8 , 162eda14cbcSMatt Macy.Xr zpool-status 8 163