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

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




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

Search: