geerlingguy / arm-nas

Arm NAS configuration with ZFS.
GNU General Public License v3.0
122 stars 6 forks source link

Work on enabling ZFS maintenance and quality-of-life improvements #1

Open geerlingguy opened 8 months ago

geerlingguy commented 8 months ago

ZFS really needs a few things added to ensure the pools and data are operating at peak efficiency.

Anything else? And how should I notify on problems? smtp-notify? Some other service?

See: https://openzfs.github.io/openzfs-docs/man/master/8/zpool-scrub.8.html#PERIODIC_SCRUB

I know that TrueNAS and other storage software takes care of some of these things click-and-point, but I'm running on Arm64, plus it would be nice to have a super efficient setup that doesn't require the extra software running on top.

Basically, I know I need to set up:

Any other notifications or periodic maintenance?

onedr0p commented 8 months ago

I would check out zed for notifications. This is pretty much the go-to tool for monitoring and notifying about what's going on with zfs.

geerlingguy commented 8 months ago

@onedr0p - Just be sure to not taunt the ZED.

geerlingguy commented 8 months ago

I just noticed there's a cron job added inside /etc/cron.d/zfsutils-linux with the following configuration:

jgeerling@nas01:~$ cat /etc/cron.d/zfsutils-linux 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# Scrub the second Sunday of every month.
24 0 8-14 * * root if [ $(date +\%w) -eq 0 ] && [ -x /usr/lib/zfs-linux/scrub ]; then /usr/lib/zfs-linux/scrub; fi

So I'd assume that will run every Second Sunday...

geerlingguy commented 6 months ago

Checking with zpool status, it looks like the last scrub was run on Sunday April 14:

jgeerling@nas01:/etc/samba$ zpool status
  pool: hddpool
 state: ONLINE
  scan: scrub repaired 0B in 0 days 04:32:46 with 0 errors on Sun Apr 14 04:56:48 2024

If my theory above is correct, the next scrub should've happened yesterday... Hmm...

geerlingguy commented 6 months ago

Ah... my estimate above was off—the schedule runs At 00:24 on every day-of-month from 8 through 14., meaning on one of those days, the if statement will trigger ($(date +\%w) -eq 0 — Sunday is 0), so this is currently set for a monthly scrubbing, on whatever Sunday falls between the 8th - 14th of the month.

That means next scrub should be May 12, mother's day!

geerlingguy commented 2 months ago

And I can confirm the scrubs have been working correctly. Just need to set up the notifications.