(originally published on 04.03.2019, reviewed/rewritten on 05.04.2025, tested on Oracle Solaris 11.4 SRU 79)
 

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 and to ensure that corrupt blocks are repaired soon by using the redundancies provided by 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 such scheduled scrubs by simply setting a ZFS property.

root@testbed:~# zpool set scrubinterval=3600 test
root@testbed:~# zpool get scrubinterval test
NAME  PROPERTY       VALUE  SOURCE
test  scrubinterval  1h     local
root@testbed:~# zpool set scrubinterval=1m test
root@testbed:~# zpool set scrubinterval=1w test

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. And yes, there is no short for minutes (at least to my knowledge, there is none documented)

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@testbed:~# zpool set scrubinterval=3599 test
cannot set property for 'test': invalid property value

But I really don’t think, that someone would do or should do a scrub every 10 minutes or so. Especially as a scrub takes a moment or two … or dependent on the disk size and space consumption on the disk a significant number of moments more.

Written by

Joerg Moellenkamp

Grey-haired, sometimes grey-bearded Windows dismissing Unix guy.