Justin Azoff

Hi! Random things are here :-)

Incremental zpool scrub

Similar to how continuous incremental scanning is a good thing for security tools, zfs supports a way to do incremental pool scrubbing.

They don't really call it that, but if you look at the options for a recent version of zpool you will see the following new option:

-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 zpool
    scrub again.

Instead of doing a full scrub once a week, you can have zfs scrub for 30 minutes every night. This will spread the IO load required to do the full scrub over multiple days, and ensure that the disks aren't busy scrubbing during the day. I set this up on my server by adding this to crontab:

#scrub zpool every day for 30 minutes
20  3   *   *   *   zpool scrub tank
50  3   *   *   *   zpool scrub -p tank

This will start (or resume) scrubbing every night at 3:20, and pause it again at 3:50. If this ends up taking too long to do the entire filesystem I can have it run for more than 30 minutes.