Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

SMART-supporting HDDs can execute several kinds of self-tests, e.g. long test, short test or conveyance test.

On Linux these can executed with "smartctl", which can also be used to read the error logs after the tests finish. The long test can take almost a day on big HDDs, while the other tests take only a few minutes.

After I had some problems with a bad HDD, I have begun to always execute all the SMART tests whenever I buy a HDD. Of course, if any test fails, the HDD must be returned immediately and the vendor cannot refuse to replace it when the request is backed by the failed SMART acceptance tests.

This is a good habit, because even if such events are very rare, I have still encountered a few HDDs that have failed the tests, so I have returned them and I have received other good HDDs.



How do you generally know when the long test is over? Is there a way to get a notification of completion? Is it ok to begin using the drives while testing? I personally run my new drives through a few rounds of badblocks


You start a long test with something like:

  smartctl --smart=on --device=sat /dev/***
  smartctl --test=long --device=sat /dev/***
(--device=sat is for the normal SATA or USB devices of Linux, such as "/dev/sda", which use SCSI commands; --device=nvme would be for NVME SSDs; other cases are described in the man page)

Then you can read from time to time the test log:

  smartctl --log=xselftest --device=sat /dev/***
When the test has finished, a line announcing that will appear in the log, saying that the test has passed or failed. If there are errors, they will appear in the log while the test progresses.

In theory you can make a script that runs periodically smartctl, e.g. once every 5 minutes, and which parses the smartctl output and signals the end of a test.

However, because I run such tests only seldom, when buying a new disk, I did not write such a script.

You can use the HDD during the test, unless the test had been started with:

  smartctl --captive --test=long --device=sat /dev/*** 
In the case of a "captive" test, attempting to use the drive for another purpose will abort the test.

While you can use the drive during a test, that will increase the duration of the test.


Thank you


You can use GSmartControl to run SMART self-tests and track their progress. It shows a progress bar for the current test.

Screenshot: https://gsmartcontrol.shaduri.dev/screenshots#a-test-in-prog....


That just displays in a nicer form the same logs that can be read with smartctl.

The progress displayed is somewhat illusory, because the estimated time until finish that is provided by the HDDs is unreliable. It is frequently wrong for the long test by even 20% to 50%, which means a difference of several hours.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: