Periodic scrubs of ZFS filesystems

It was and is always a best practice to do regular scrubs of your ZFS filesystems in order to ensure that all checksums … well … check out to ensure that corrupt blocks are repaired soon by using the redundancies of a mirror or a RAIDZn. However it was always a task for a homegrown cronjob in order to do so. Since Oracle Solaris 11.4 there is a much easier way to do this scheduled scrubs by simply setting a ZFS property.

root@sol114:~# zpool set <strong>scrubinterval=3600</strong> testpool
root@sol114:~# zpool set <strong>scrubinterval=1h</strong> testpool
root@sol114:~# zpool set <strong>scrubinterval=1m</strong> testpool

You can use s (second, default), h (hour), d (day), w (week, 7  days), m (month, 30 days) and y (year, 365 days) to define an interval but internally they are converted to seconds.

However you have to keep in mind that you can’t set scrubinterval shorter than 60 minutes. Trying to do so will just result in a error message.

root@sol114:~# zpool set <strong>scrubinterval=3599</strong> testpool
cannot set property for ‚testpool‘: invalid property value

But I really don’t think, that someone would do scrubs each hour.