SMART Testing Information Question

Status
Not open for further replies.

gamedude9742

Dabbler
Joined
Oct 1, 2014
Messages
26
Hello Everyone,

This might be mentioned elseware but a forum / google search didn't jump anything out at me.

When using SMART test scheduling and manually calling via smartctl in the CLI.

You can run
Code:
smartctl -l selftest *drive*
and it will output the results of the last test. However I don't see a mention of the DATE/TIME the test was run.

I know you can setup the GUI portion to automatically run every x Hours, Days, etc.. however it would be great if there was a way to see the last test time as a form of validation that it is actually executing.

Any input? I do know a good amount about windows scripting and have used custom log / flag files in the past. I know I could figure out a bash method to accomplish this but wanted to know if anyone knew something I didn't as I assume its already listed somewhere.

If I do have to write a script to get this info it would follow logic similar to below:
Code:
echo %DATE% %TIME% "Starting SMART" %TestType% %Device%
** Execute Smart Test **
echo %DATE% %TIME% "Completed SMART" %TestType% %Device%

I could always add variables and such to show total test time, and options to have it email the results log, etc...

Like I said, i have no issue writing a bash script to do this, but if it already exists somewhere why re-invent the wheel.

Thanks!

PS: If I do need to write a script, I will upload it here once its completed so everyone can benefit if they so choose :)
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
However I don't see a mention of the DATE/TIME the test was run.
That would be because the disks don't have an onboard real-time clock, they only track hours in service.
 

gamedude9742

Dabbler
Joined
Oct 1, 2014
Messages
26
That would be because the disks don't have an onboard real-time clock, they only track hours in service.
Valid point, however the system does have a date / time associated.

I suppose I should have been a bit more specific. I don't necessarily want to know the last time a SMART test was run on a disk. I want to know the last time I RAN a SMART test on my disks in my FreeNAS build.

Like if I were to buy a new hard drive and hook it up I know there is no possible way to know the date / time of the last SMART test. However, if that drive has been in my FreeNAS build for 3 months doing SMART tests as often as once a week, there should be a way to see the last time FreeNAS sent the command to perform said SMART test right?
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
I want to know the last time I RAN a SMART test on my disks in my FreeNAS build.
I've seen this request, or variations on it, a number of times recently, and I just don't see the point. If you scheduled the test (and the system was running at the time), it ran. If anything bad is showing up in the SMART data on the disk, and you've configured your email settings correctly (which you should), you'll get an email alert. But with that said, I'd expect the data to be logged in the system log file.
 

gamedude9742

Dabbler
Joined
Oct 1, 2014
Messages
26
The system log file. There we go makes sense I'll check in there.
If you scheduled the test (and the system was running at the time), it ran
For FreeNAS thats probably a perfectly valid statement, but the background of why I started this thread is really based on my job. I'm an Endpoint Admin and just about every single thing I do must include a Start Time, End Time, Exit Code, etc... or else "it didn't happen" and in the event of ANY issue I would need to go digging for the above information to prove / defend what occured.

It's that mindset that made me ask the question on last execution time of a SMART test.

Thanks for the info!
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
The run time hours can do what you want. You look at smart and see how many hours the disk has been running then look at the smart test and see in what hours did that test run. You can then say the test ran X hours ago.
 

gamedude9742

Dabbler
Joined
Oct 1, 2014
Messages
26
The run time hours can do what you want. You look at smart and see how many hours the disk has been running then look at the smart test and see in what hours did that test run. You can then say the test ran X hours ago.
That could absolutely work. Perfect. For my uses a start / end, etc. would be over kill.
I'd just be happy to know the test ran 3 hours ago or w/e from the email alert or w/e. Just so I can confirm I'm not getting old data.

Thanks Everyone!
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
...and if you'd like to see in the GUI the last time the test ran for each disk, submit a bug report making that request. I don't see any purpose in it (as I've said), but you're at least the third person in the last few weeks to ask for something like this, so there may be something I'm missing. It'd be up to the devs in any event, but that would at least put the issue on their radar.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,995
I have a script which sends me an email every morning at 7AM sharp. It provides me all the status on all of my hard drives and would do what you desire, enable you to track testing events, however it will not produce the specific time a test was conducted. With that said, you could generate a script that could provide you the date/time the test was completed, that would be easy however you have to make an assumption that the drive power was not securred. And again, the script could take that into account as well by checking the power cycle value against the previous value and tell you that power was dropped so the estimation could be wrong. Yup, easy. ANd you would need to use serial numbers to compare with as someone could pull a few drives and relocate them thus you could not rely on drive identifiers like ada0, ada1. Again, simple stuff to do if YOU are willing to do this.
 
Status
Not open for further replies.
Top