1

I saw SmartMonTools: How can I know if there is any smartctl test running on my hard disk? and ran -

$ sudo smartctl -a /dev/sdb | grep "progress" -i -A 1
# 3  Extended captive    Self-test routine in progress 90%       216         -
# 4  Offline             Interrupted (host reset)      60%       215         -
# 5  Short captive       Self-test routine in progress 60%       215         -
# 6  Offline             Interrupted (host reset)      60%       215         -
# 7  Short captive       Self-test routine in progress 60%       215         -
# 8  Short offline       Completed without error       00%       215         

I was running a long extended test.

Now It is very tricky to find out what the state is because the 1st one I interrupted as well but it still it shows the above -

and running it as -

$ sudo smartctl -a /dev/sdb | tail
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Aborted_by_host [90% left] (0-65535)
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

So does it mean that no tests are running atm or what ?

Another query is how do I make sure that no test is running at all, before running a test.

There is supposed to be -

$ sudo smartctl -X /dev/sdb

Need some way to confirm the same that no test is running in the background.

1

All your self-test log data structure entries are either "Not testing" or "Aborted", so there is no self-test running (or rather, there was no self-test running when you ran smartctl). That is how you verify that no test is running. In your output, the information for span 1 matches log entry #3, both indicate there was 90% of the test left to run when it was aborted. Log entries #1 and #2 might have more information...

As you point out, smartctl -X can be used to abort non-captive (background) self-tests.

In practice I find the easiest way of dealing with all this is simply to use smartd and have it run background tests regularly; then there's no need to worry about stopping tests or find out whether any background tests are running. Obviously if you're looking for captive test results quickly on a new drive, that doesn't apply!

0

For offline testing still running you might have in the -a output

Offline data collection status:  (0x03)   Offline data collection activity
                                          is in progress.

and

Total time to complete Offline 
data collection:               (   35) seconds.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.