dak180 / FreeNAS-Report

SMART & ZPool Status Report for FreeNAS/TrueNAS
GNU General Public License v3.0
38 stars 8 forks source link

Some HDDs do not report Rotation Rate #7

Closed mth309 closed 2 years ago

mth309 commented 2 years ago

In a prior conversation you asked me to post examples of HDDs that do not report a rotation rate value. Remember that as we discussed, almost nothing about how SATA drives report is actually standardized. To make a tool like this you have to make a bunch of assumptions, on top of the assumptions smartctl has already made for you, and many times those assumptions won't be true and will misinform the output. This rotation rate is just one specific case, but the whole attribute table is even worse. For example assuming reallocated sectors is always attribute 5 is just plain false, even though the big 4 HDD manufacturers do use it in that way. It's good enough as a starting assumption, but as you find other drives that diverge it becomes a pain to keep track of all the different behaviors. You end up with messy code with as many exceptions as rules, once you've found a couple dozen of these outliers.

What you don't want to do is things like "if there's no attribute 5, read 172 instead, and if there's no 172 read 185" etc. That will get you in trouble quick, because while you might have seen one drive that stored reallocated sectors in 172 (made up number for the example), some other drive will use 172 for something entirely different and on that drive you'll read 2349876234 reallocated sectors because all you did is look at the attribute numbers and make an assumption. Then the tool is misleading a user into throwing away a perfectly good drive, because it didn't understand how to read the SMART output, but it didn't bother to indicate that it didn't know. To be fair the owner obviously didn't know either so you can't completely blame a tool creator, but I'm just saying.

With a ton of experience and examples of different drive types your parsing assumptions will get better, but it's impossible to be correct all the time. In my own tool, I mark outputs that I'm not 100% sure about (drives I'm not experienced with) with an asterisk, and certain drive types trigger other footnotes on certain outputs, where I feel the user needs to know something more than just a numeric value that could be misleading.

At least the standards are a lot cleaner for SCSI and NVME so you don't have to deal with this kind of stuff! :)

da8 json no rate.txt da8 norm no rate.txt da13 json no rate.txt da13 norm no rate.txt

mth309 commented 2 years ago

I just submitted a pull request with the code I sent you last week that fixes this issue, BTW. Figured I'd try to learn this github process to make it easier on you vs. continuing to send you code in forum comments :) I hope I did it right, this is all new to me. Thanks!

dak180 commented 2 years ago

@mth309 how are things working now both with these drives and the sas ones?

mth309 commented 2 years ago

I grabbed your latest master, with the NVME fix, and it runs great on both servers. When I get some time I'll consider sending you some feature requests, but I don't see anything I can call a bug right now. Thanks for working with me and accepting my suggestions!