How do I slow down a scrub? Do I need to?

I know scrubbing is important. But I have the tendency to pause the scrub when I have other important tasks that need disk IO.

I suppose question #1: Does the scrub prioritize normal IO operations? Meaning I don’t have to worry about starving other apps while a scrub is in progress?

If Question #1 is a no, then question #2: How do I slow it down?


You can add an upper and lower bound to the scrub IOs via the zfs_vdev_scrub_max_active and zfs_vdev_scrub_min_active module parameters. They can be set at module load time, or via the interface exposed in /sys/module/zfs/parameters.

Scrubs do prioritize other operations above them for ZFS’s own prioritization, but spinning rust is still bad at random IO, so it would need to know a while in the future to predict whether a request would interfere with performance of future requests no matter how much it preempts any pending IOs for it.

I find that scrubs do impact system performance in practice. They especially impact other ZFS operations, like listing snapshots. Sanoid runs take a lot longer when a scrub is active.