System Scrubs (or does something busy) every 42 days?

Status
Not open for further replies.

MrChips

Cadet
Joined
Aug 31, 2013
Messages
8
I have set up and been running my FreeNAS a long time now and it's been humming along beautifully!

When I set it up, I added a CRON job to log my CPU and disk temps every 15 minutes, then promptly forgot that I did so. It's been happily collecting data since my last reboot back in June 2015. Today I remembered about this and checked the file. I brought it into excel and did some graphing, and everything is nominal, except...

I found a strange heat anomaly: Precisely every 42 days at midnight, the heat signatures of my CPU and all my drives spike upward significantly for about 1.5 hours, then drop back to normal. Here's a graph:

42days.png


I performed a "zpool status" and found that the last date of scan/scrub coincided exactly with the last heat spike I saw. So I know that scan/scrub activity is responsible for the heating but that brings up my question:

Why 42 days?

When I look at my CRON, the only scrub entry is set to run at a 35 day interval:

... /usr/local/sbin/scrub -t 35 master

So, as a complete noob, I would love to know why does this happen every 42 days? Has Douglas Adams taken over my zpool scrubbing timeline? Should I be looking for a towel ASAP? o_O

Thanks ahead of time!

Sincerely,
Rich
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
FreeNAS sets up a scrub by default when you create a pool. Scrub scheduling is, IMO, more complex than it needs to be, but in brief, there are cron job settings and there's a threshold setting. The default cron job setting is Sundays at midnight. The default threshold setting is 35 days. The threshold is measured from the time the previous scrub ended. And, of course, a scrub takes a non-zero amount of time.

So, putting that together, a cron job runs every Sunday at midnight executing the scrub script with a threshold of 35 days. If it has been less than 35 days since the most recent scrub completed, the script terminates without running a scrub. If it's been at least 35 days, the scrub runs. So, let's suppose that the script ran a scrub this morning. You'd think that the next one would go 35 days from now, on 3 Jan 16. However, at midnight on 3 Jan 16, it's been less than 35 days since the previous scrub finished (it may be 34:23:59, but that's still less than 35 days). So, the scrub doesn't run on 3 Jan. The next Sunday, 10 Jan 16, it will have been more than 35 days, so the scrub runs.
 

MrChips

Cadet
Joined
Aug 31, 2013
Messages
8
So if I understand this right: You're saying it adds a week because CRON is set to a weekly interval, so add 7 days to the 'scrub' interval: 35+7 = 42.

Theoretical exercise: If I wanted it to run every 35 days, I'd have to set CRON to run 'scrub' on a daily basis, then set my check interval to '-t 34' (to deal with the non-zero time it took to execute).

Makes PERFECT sense to me! ;)

Thanks Dan!
 
Last edited:

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Or in others words: 35 + 7 = 42 :)

Edit: ok, seriously, what happened here? same post at the same time, WTF?
 

MrChips

Cadet
Joined
Aug 31, 2013
Messages
8
Sorry, I was editing my original to add some color commentry. Might have messed with the timing a little.
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
No need to be sorry, it was just impressive and fun :D
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
If I wanted it to run every 35 days, I'd have to set CRON to run 'scrub' on a daily basis, then set my check interval to '-t 34' (to deal with the non-zero time it took to execute).
That would work, as long as you were sure it would take less than 24 hours to run. But really, you wouldn't have to adjust the cron settings at all--just drop the threshold by a day or two (i.e., 33-34 days), and it should run every five weeks on Sunday rather than every six weeks.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,553
There was some software at work that if you had a licensing issue, it would pretend to authenticate with your file server for exactly 42 seconds then generate a 'invalid credentials' error. Damn programmers and their 'hitchhikers guide' references.
 
Status
Not open for further replies.
Top