logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

zpool-scrub — begin or resume scrub of ZFS storage pools

Description

       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 (mirror, raidz, or draid) devices, ZFS automatically repairs
       any damage discovered during the scrub.  The zpoolstatus command reports the progress of the  scrub  and
       summarizes the results of the scrub upon completion.

       Scrubbing  and resilvering are very similar operations.  The difference is that resilvering only examines
       data that 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.

       When scrubbing a pool with encrypted filesystems the keys do not need to be loaded.  However, if the keys
       are  not  loaded  and  an unrepairable checksum error is detected the file name cannot be included in the
       zpoolstatus-v verbose error report.

       Because scrubbing and resilvering are I/O-intensive operations, ZFS only allows one at a time.

       A scrub is split into two parts: metadata scanning and block  scrubbing.   The  metadata  scanning  sorts
       blocks  into  large sequential ranges which can then be read much more efficiently from disk when issuing
       the scrub I/O.

       If a scrub is paused, the zpoolscrub resumes it.  If a resilver is in progress, ZFS  does  not  allow  a
       scrub to be started until the resilver completes.

       Note  that,  due to changes in pool data on a live system, it is possible for scrubs to progress slightly
       beyond 100% completion.  During this period, no completion time estimate will be provided.

Examples

Example1
       Status of pool with ongoing scrub:

       # zpoolstatus
         ...
         scan: scrub in progress since Sun Jul 25 16:07:49 2021
               403M / 405M scanned at 100M/s, 68.4M / 405M issued at 10.0M/s
               0B repaired, 16.91% done, 00:00:04 to go
         ...

       Where metadata which references 403M of file data has been scanned at 100M/s, and 68.4M of that file data
       has been scrubbed sequentially at 10.0M/s.

Name

       zpool-scrub — begin or resume scrub of ZFS storage pools

Options

-s  Stop scrubbing.

       -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 zpoolscrub or zpoolscrub-e again.

       -w  Wait until scrub has completed before returning.

       -e  Only  scrub  files  with  known  data errors as reported by zpoolstatus-v.  The pool must have been
           scrubbed at least once with the head_errlog feature enabled to  use  this  option.   Error  scrubbing
           cannot  be run simultaneously with regular scrubbing or resilvering, nor can it be run when a regular
           scrub is paused.

       -C  Continue scrub from last saved txg (see zpool last_scrubbed_txg property).

Periodic Scrub

       On machines using systemd, scrub timers can be enabled on per-pool basis.  weekly and monthly timer units
       are provided.

               systemctlenablezfs-scrub-weekly@rpool.timer--nowsystemctlenablezfs-scrub-monthly@otherpool.timer--now

See Also

systemd.timer(5),zpool-iostat(8),zpool-resilver(8),zpool-status(8)

OpenZFS                                         November 18, 2024                                 ZPOOL-SCRUB(8)

Synopsis

zpoolscrub [-e |-p | -s| -C][-w] pool

See Also