S.M.A.R.T. for USB drives

I have a 4TB WD MyBook attached to my rockstor box via USB3. It works pretty well, but Rockstar reports that S.M.A.R.T. is not supported. That is not the case. if I run

smartctl -d sat -a /dev/sdb

I get the following output. Is this something that would be easy to add to Rockstor?

@sudowoodo I hope so, it’s supposed to work already and does with many devices but we have come across a few controllers that seem to throw the Rockstor parser, it’s something I’m due to look at pretty soon hopefully so thanks for reporting.
I’m not at home at the moment so a bit tricky for me to check but I’m assuming the “-d sat” is the key to getting it working for you here?
In which case as a jury rig for the time being you could try adding that option to the various smartctl commands that you will find in /opt/rockstor/src/rockstor/system/smart.py on the lines that say “run_command”, be sure to give it it’s own quotes like the -a etc and a comma. We could maybe add an empty option to all of these that can be filled later via the GUI or to simplify adding such an option to all commands in the future.

Sorry a bit loose but I will try and look at this as part of one of my next issues.

Let us know how you get on with the jury rig if you try it. Thanks.

Thanks for reporting this.

@phillxnet thanks for your quick reply. I tried your suggestion of adding the ‘-d sat’ to the run_command lines in smart.py. Unfortunately it did not work. It caused Rockstor to think my internal ssd was not S.M.A.R.T. enabled. If you have any more ideas, I will be happy to try them.

Thanks for your help.

EDIT:

I looked at the logs and saw how run_command was being read. I was able to figure out the format and now your fix works.

Thanks!

1 Like

@sudowoodo Oh that’s great, thanks for reporting. Yes I should have been more specific but was unfortunately away from home and bashed my last response out a tad. Thanks for persevering. Only a hack for now though and note that you will have to re-apply whatever you did after each Rockstor update as the files will be overwritten.

Would you mind pasting here how you successfully edited the command, that way if anyone else has the same issue / requirement, then we have a known good example of a jury rig / Heath Robinson approach to sorting it until some more elegant approach is devised to add these custom commands when they are needed.

Also note that if you look into submitting that interface / drive combo upstream to the smartmontools folks then in the future it will not need special attention like this. That I believe is the meaning of the “Not in smartctl database” message. I’ve submitted one or two myself and they then end up in the db in future releases which is nice. I think one of the ones I put in was a MyPassport model of some description.

Thanks.

Just thought to add for onlookers that it is required to reboot, or at least restart the rockstor.service for these edits to take effect. Otherwise the system just keeps on using the old version of the python file.

@phillxnet sorry for the delay. I am going to look into submitting that drive into smartmoxntools today. I never thought of doing that.

This is what one of the lines looked like before I added to it:

o, e, rc = run_command([SMART, '-H', '--info', '/dev/%s' % device], throw=False)

Here is the line after I added the -d sat:

o, e, rc = run_command([SMART, '-d', 'sat', '-H', '--info', '/dev/%s' % device], throw=False)

There are 8 lines that need to be changed. After rebooting, I had to click around in the disk section for a while before Rockstor reported that the drive was S.M.A.R.T. enabled.

1 Like

@sudowoodo This is great, thanks. This can now serve as an example of how to hot wire custom -d options into Rockstor’s smart commands. Well done.
Let us know how you get on with the smartmontools submission, I believe they have guidelines on what they need and in my very limited experience were entirely helpful and receptive. It’s a shame more manufacturers don’t submit their drives to them as a matter of course.
Also I believe they have engineered it so that one can update just the database with a single command so the moment they add it to the upstream db you pull in the updated db of known drives and test your own submission. Nice.

@phillxnet, I have good news and bad news. I found out that my drive was already in the smartmontools database. I had to run the command below to update the drive database.

/usr/sbin/update-smart-drivedb

The bad news is that I cannot perform any self tests from the web-ui. I get an error.

@sudowoodo No worries, there is already a fix out for that in the testing channel (3.8-10.03 onwards) but unfortunately it’s not yet propagated to stable, it was submitted and merged only a few days ago. So if you are on the testing channel then just apply your updates, and if you are on the stable channel it’s a trivial edit of 2 lines in one file. Please see “S.M.A.R.T error global name ‘smart’ is not defined” where @mrblomblom reported the same issue. The instructions for manually applying the fix are in the third post in that threat.

Hope that sorts it for you.

Oh and thanks for the reminder / sharing of the smart db update command.

@sudowoodo There is now a more specific issue opened to address the need to “add custom SMART parameter option” I’m afraid it didn’t end up being included in the existing and now closed issue mentioned previously “no SMART info on MSA70” which did improve things SMART wise but unfortunately not with regard to adding custom parameters. We have since had other requests for adding custom options so your contribution here has definitely helped. Thanks.

@sudowoodo Just to let you know that as of 3.8-12.04 (testing channel) the add custom SMART parameter option issue has been closed.

Here is a picture to demo the addition of the same -d sat that your drive required; here it enables the smart info on one of a pair of 32 GB Sandisk Extreme USB 3.0 devices.

Again thanks for you assistance on this and hopefully we should no longer require hot wiring / jury rigging of custom options for the like of some external usb to sata adapters and their smartmontools kin.

1 Like

Thanks for the update @phillxnet. I look forward to this in the next stable release.