Scheduled Data Scrubbing

Data inconsistencies can occur over time. Scrubbing the data regularly helps to find these inconsistencies and resolve them early. Thus, regular scrubbing ensures data availability.

In this release, automatic scrubbing is added as a preventative maintenance tool. Automatic or scheduled data scrubbing is now part of routine operations. The feature is enabled by default upon installation. Two ZFS properties are associated with scheduled scrubbing:

  • scrubinterval determines the time interval between automatic scrubbing. The value is specified together with the following units of time: s, h, d, w, m, or y. These correspond to second, hour, day, week, month, or year, respectively. A week can also be specified as 7 days, a month as 30 days, and a year as 365 days. By default, the time interval is set to 30 days.

    Note:

    Setting the interval to manual disables automatic scrubbing.

    When you set the time interval, you must use only a single time unit, not a combination of units.

    • Incorrect

      $ zpool set scrubinterval=1w3d
      
    • Correct

      $ zpool set scrubinterval=10d
      
  • lastscrub is a read-only property that specifies the start time of the last scrub that either completed successfully or was canceled. The system uses this value to calculate the next scrubbing based on the specified interval.

You can manually start the scrub operation outside of the scheduled time. The operation would fail if a scheduled scrub is already in progress.

Just like with a manual scrub, you can cancel an ongoing scheduled scrub. In this case, a scrub operation will be scheduled to run at the next period as specified by the interval and calculated from the start time of the canceled scrub. To cancel an ongoing scrub operation, you use the following command:

$ zpool scrub -s

A scheduled scrub runs only when no other scrub or a resilver operation is in progress. When you initiate a resilver operation, an ongoing scheduled scrub is immediately canceled, and will restart after the resliver completes.