I am relatively new to TrueNAS scale, and I know that using CLI commands can be very dangerous.
I want to create a cron job that will create a complete SMART report every day. I already set up short and long periodic smart tests that will send a mail when there is a problem, but I’d like to be able to take a peek by myself regularly.
I already tested this script:
#!/bin/bash
REPORT_DIR="/mnt/raid/data/SmartReports"
mkdir -p "$REPORT_DIR"
TIMESTAMP=$(date +"%m-%d-%Y (%H-%M-%S)")
REPORT_FILE="$REPORT_DIR/$TIMESTAMP.txt"
> "$REPORT_FILE"
echo "S.M.A.R.T. status report for $(date)" >> "$REPORT_FILE"
echo "" >> "$REPORT_FILE"
for disk in $(smartctl --scan | awk '{print $1}'); do
echo "=== $disk ===" >> "$REPORT_FILE"
smartctl -a "$disk" >> "$REPORT_FILE" 2>&1
echo "" >> "$REPORT_FILE"
done
that seems to work well.
Is it safe to create (with the GUI this time) a cron job to run it every day?
This seems to be a no-brainer, but these are famous last pool words.
You might want to look into @joeschmuck’s Multireport also. I don’t see why a short SMART test wouldn’t work, long tests may take more than a day to execute.
It looks safe to me. There is no issue in running a SMART Self-test every day. I recommend a Short test every day, a Long test once a week, depending on how many drives and the capacity. If you have large drives, you will likely not want to run a SMART Long test when a scrub or resilvering is occuring, so watch out for those possible pitfalls. Multi-Report does take those into account.
Multi-Report started out like this, way back when we were at FreeNAS 8.? so it’s grown quite a bit. But if you want to do your own thing, that is perfectly understandable.
That is odd. It is a link to the forum for the Multi-Report thread. When you find it, the very first posting has a link to GitHub. Almost 700 posts later you will be at the end of the thread. I do not recommend reading it all, unless you need a good nap. Read the first posting as I do update it, and the last 2 pages of postings. We don’t have many issues come up but when they do, solutions are generally pretty quick.
If you have any questions, reach out and ask me. I’m more than happy to help.