| ▲ | atmosx 10 hours ago |
| Once a month is fine ("/etc/cron.monthly/zfs-scrub"): #!/bin/bash
#
# ZFS scrub script for monthly maintenance
# Place in /etc/cron.monthly/zfs-scrub
POOL="storage"
TAG="zfs-scrub"
# Log start
logger -t "$TAG" -p user.notice "Starting ZFS scrub on pool: $POOL"
# Run the scrub
if /sbin/zpool scrub "$POOL"; then
logger -t "$TAG" -p user.notice "ZFS scrub initiated successfully on pool: $POOL"
else
logger -t "$TAG" -p user.err "Failed to start ZFS scrub on pool: $POOL"
exit 1
fi
exit 0
|
|
| ▲ | k_bx 8 hours ago | parent | next [-] |
| Didn't know about the logger script, looks nice. Can it wrap the launch of the scrub itself so that it logs like logger too, or do you separately track its stdout/stderr when something happens? update: figured how you can improve that call to add logs to logger |
| |
| ▲ | nubinetwork 5 hours ago | parent [-] | | Scrub doesn't log anything by default, you run it and it returns quickly... you have to get the results out of zpool status or through zed. |
|
|
| ▲ | chungy 9 hours ago | parent | prev [-] |
| That script might do with the "-w" parameter passed to scrub. Then "zpool scrub" won't return until the scrub is finished. |