Smart algorithm is built into modern storage devices through which devices monitor, store, and analyze the health of their operation.
Smart collects temperature, disk sector info, seek errors etc on an SSD or HDD which can use to measure the health of a device, predict possible device failure, and provide notifications on unsafe values before the disk was to crash.
Installation of Smartmontools
Smart tools can be installed using the below command
sudo apt-get install smartmontools
Use the following command, to query if hard disk supports SMART and is enabled,
sudo smartctl -i /dev/sda
Sample Output is shown
Running a Short Test
A short test helps in the rapid identification of a defective hard drive and typically will complete within 2 mins.
The test does check the internal properties like electric circuits, LBA, positioning of the spindle, data disk read/write verification etc.
Typically only a section of a disk is checked for its properties in short test.
Running a Long Test
This test is usually used by manufacturers to check every segment of the entire disk and not just a section. The Long test could run for few hours to comeplete.
Test procedure with smartctl
Depending on the type of disk you are using this command should give us an approximate indication of the time duration of the various tests
To perform smart test in background mode
sudo smartctl -c /dev/sda
Verify the Test Results
We can verify the health of the disk by running either of these commands
sudo smartctl -a /dev/sda
sudo smartctl -l xerror /dev/sda
Sample Output will be as below showing the errors logged on a disk