Closed csm10495 closed 1 year ago
Hi Charles @csm10495,
I'm going pick your raw data and check what is going wrong.
In any case, to your comment
Optimally it would be nice to be able to run and query self tests from py-SMART
Note that there are methods test_start
& test_stop
exactly to do what you are requesting on the pysmart
object and run_selftest
on the device
object
Just to take into account:
Hi again @csm10495
Please, check the develop branch and tell me if everything works fine now.
Cool. Getting closer: though i noticed printing a test doesn't work:
In [13]: t = d.tests[0]
In [14]: t
Out[14]: <SMART Self-test [Extended|Completed without error] hrs:3442 LBA:None>
In [15]: print(t)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In [15], line 1
----> 1 print(t)
File ~\Desktop\py-SMART\pySMART\testentry.py:170, in TestEntry.__str__(self)
153 return ("{0:>2} {1:17}{2:23}{3:7}{4:14}[{5:4}{6:5}{7:4}]".format(
154 self.num,
155 self.type,
(...)
161 self.ASCQ
162 ))
163 elif self._format == 'nvme':
164 ## NVME FORMAT ##
165 # Example smartctl output
(...)
168 # Num Test_Description Status Power_on_Hours Failing_LBA NSID SCT Code
169 # 0 Extended Completed without error 3441 - - - -
--> 170 return ("{0:>2} {1:18}{2:29}{3:16}{4:13}{5:5}{6:4}{7:4}".format(
171 self.num,
172 self.type,
173 self.status,
174 self.hours,
175 self.LBA,
176 self.nsid,
177 self.sct,
178 self.code
179 ))
TypeError: unsupported format string passed to NoneType.__format__
In [16]: d
Out[16]: <NVME device on /dev/sda mod:Samsung SSD 980 PRO 1TB sn:S5P2NG0NB05964V>
In [17]: d.tests
Out[17]:
[<SMART Self-test [Extended|Completed without error] hrs:3442 LBA:None>,
<SMART Self-test [Extended|Completed without error] hrs:3441 LBA:None>,
<SMART Self-test [Short|Completed without error] hrs:3441 LBA:None>,
<SMART Self-test [Short|Completed without error] hrs:1361 LBA:None>,
<SMART Self-test [Extended|Completed without error] hrs:866 LBA:None>,
<SMART Self-test [Short|Aborted: Self-test command] hrs:865 LBA:None>,
<SMART Self-test [Short|Completed without error] hrs:340 LBA:None>]
I also tried doing a run_selftest_and_wait()
and it looks like it returned the last run test immediately instead of waiting for the new test to start. Running it again gave back 'self test already in progress'.:
In [18]: d.run_selftest_and_wait('short')
Out[18]: (0, <SMART Self-test [Extended|Completed without error] hrs:3442 LBA:None>)
In [19]: d.run_selftest_and_wait('short')
Out[19]: (1, 'Self-test already in progress. Please wait.')
When running a long test, i'm not quite sure it did anything, though it should have worked:
In [44]: d.run_selftest_and_wait('long')
Out[44]: (0, <SMART Self-test [Short|Completed without error] hrs:3473 LBA:None>)
In [45]: d.run_selftest_and_wait('long')
Out[45]: (0, <SMART Self-test [Short|Completed without error] hrs:3473 LBA:None>)
In [46]: d.test_capabilities
Out[46]:
{'offline': False,
'short': True,
'long': True,
'conveyance': False,
'selective': False}
Hi @csm10495
I made a couple of fixes. I think it should work now, or at least everything I've tested does. Please, check them when you have time.
Getting closer. Now it seems like it ran a test, but only once. Now if I try to run another, it seems to immediately pass but not add to d.tests
which makes me think its not kicking the test again.
In [33]: d.run_selftest_and_wait('short')
Out[33]: (0, <SMART Self-test [Short|Completed without error] hrs:3481 LBA:None>)
In [34]: len(d.tests)
Out[34]: 9
In [35]: d.run_selftest_and_wait('short')
Out[35]: (0, <SMART Self-test [Short|Completed without error] hrs:3481 LBA:None>)
In [36]: len(d.tests)
Out[36]: 9
In [37]: d.run_selftest_and_wait('short')
Out[37]: (0, <SMART Self-test [Short|Completed without error] hrs:3481 LBA:None>)
In [38]: len(d.tests)
Out[38]: 9
In [39]: print(d.tests[0])
0 Short Completed without error 3481 - - - -
In [40]: d.update()
In [41]: len(d.tests)
Out[41]: 9
...
In [44]: d.run_selftest_and_wait('long')
Out[44]: (0, <SMART Self-test [Short|Completed without error] hrs:3481 LBA:None>)
In [45]: d.update()
In [46]: len(d.tests)
Out[46]: 9
Hi @csm10495
Locally, when I've tested it, it worked perfectly. 9 may be a limit in how many tests are reported on smartctl.
Could you please check that's correct? I don't see any logic path on the code that may it work only once. You can also test "short" and "long" alternatively so it's easier to view if new tests are appearing.
I think smartctl itself is messing something up here. It doesn't seem to want to actually kick the tests, but when i use Samsung Magician to kick the test, it can report the test status just fine. Similarly aborting the test doesn't do anything with smartctl but works fine with Magician. Looks like the tests appear in smartctl's listing after completion/abortion still.
I'm guessing that the issues I'm seeing are directly because smartctl (and not necessarily py-SMART) is acting funky.
Here's a video to show the full behavior and testing:
https://user-images.githubusercontent.com/5749838/228715935-66c36cce-36f0-4913-80bb-f5416aa38e3a.mp4
I think from py-SMART's perspective ya did what you could. I've filed: https://www.smartmontools.org/ticket/1708 with smartmontools. I think this is ready to be closed out.
Thanks!
Thank you Charles!
Don't hesitate to open any new issue you found out there!
Describe the bug When trying to do a self-test with NVMe on Windows, it seems to act a bit weird. For example:
smartctl can see device self test runs:
pySMART can't see the same
Raw outputs Please, provide the following raw command outputs to be added to our test-base. Notify explicitly if you don't want them to be incorporated. In any case, they are "mostly required" to check and verify your issue/bug.
Environmental setup: Note i'm using a nightly build of smartctl since the latest released doesn't work properly with nvme self-tests.
Additional context Optimally it would be nice to be able to run and query self tests from py-SMART