The smartmontools package contains two utility programs (smartctl and smartd) to control and monitor storage systems using the Self-Monitoring, Analysis and Reporting Technology System—SMART—built into most modern ATA and SCSI hard disks. In many cases, these utilities will provide advanced warning of disk degradation and failure. All you need is a modern S.M.A.R.T. capable hard disk.
STEP 1
To install smartmontools follow the given command:
sudo apt-get install smartmontools
The above command will install smartmontools on your system. Now check if your drive is actually SMART type:
sudo smartctl -i /dev/sda
Step 2
Now, enable SMART service.
sudo smartctl -s on /dev/sda
Step 3
With SMART enabled on your system, let’see how to work with it. The tool used to test your hard drive has three types of tests to perform. You can check all that info by typing:
sudo smartctl -c /dev/sda
Using the respective commands for Short, Long and Conveyance tests, you can see the time it takes to complete all three tests. You can start with any test individually as you like:
sudo smartctl -l long /dev/sda (for long test)
sudo smartctl -short /dev/sda (for short test)
sudo smartctl -conveyance /dev/sda (for conveyance test)
Step 4
To get your test results you will have to type:
sudo smartctl -l selftest /dev/sda
Step 5
There is also a GUI version of this application which can be installed by:
sudo apt-get install gsmartcontrol.
This is how the GUI looks like, right click on the drive and you can find some other options in it.