Bug 291234 - periodic/daily/800.scrub: does not initiate a scrub on a new zpool
Summary: periodic/daily/800.scrub: does not initiate a scrub on a new zpool
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 14.3-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-11-26 12:41 UTC by Dan Langille
Modified: 2025-11-26 19:36 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Langille freebsd_committer freebsd_triage 2025-11-26 12:41:32 UTC
I created a new zpool yesterday. I expected 800.scrub to scrub it last night. It did not. It thinks the last zpool was zero days ago.

Scrubbing of zfs pools:
   skipping scrubbing of pool 'data01':
      last scrubbing is 6 days ago, threshold is set to 7 days
   skipping scrubbing of pool 'data02':
      last scrubbing is 6 days ago, threshold is set to 7 days
   skipping scrubbing of pool 'data03':
      last scrubbing is 6 days ago, threshold is set to 7 days
   skipping scrubbing of pool 'zroot':
      last scrubbing is 0 days ago, threshold is set to 7 days

The truth is: zroot has never had a scrub.
Comment 1 Dan Langille freebsd_committer freebsd_triage 2025-11-26 12:49:33 UTC
The script uses creation_time if "no scrub was done".

I suppose that's a fair compromise.
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2025-11-26 17:30:42 UTC
^Triage: actually, 'conf' is correct for periodic scripts.
Comment 3 Dan Langille freebsd_committer freebsd_triage 2025-11-26 18:44:40 UTC
(In reply to Mark Linimon from comment #2)

Ironically, I moved it to bin after seeing https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261855 in bin (I've since moved it over).
Comment 4 Ed Maste freebsd_committer freebsd_triage 2025-11-26 19:13:25 UTC
So in essence the issue is just that the message would more correctly be "last scrubbing or pool creation is 0 days ago"

maybe "day 0 of 7 until next scrub" or "day 6 of 7 until next scrub" would still be clear but also pedantically correct
Comment 5 Dan Langille freebsd_committer freebsd_triage 2025-11-26 19:36:46 UTC
(In reply to Ed Maste from comment #4)

The background.

* I created a new zpool yesterday.
* Later, Nagios told me the zpool hadn't been scrubbed yet.
* In my head: oh, that will change tonight with the daily scripts run.
* This morning: Oh, wait, why didn't it scrub?
* Which led me to the script and this PR.

Granted: my problem is the Nagios check which doesn't know the difference between "no scrub" and "just created".

The counter to this PR is:

* just do a scrub and silence the Nagios check
* there's no need to do a scrub on a new zpool (I'd argue that there is every reason to do a scrub)