Smartctl is a command line utility or a tool in UNIX like operating system that perform SMART tasks such as printing the SMART self-test and error logs, enabling and disabling SMART automatic testing, and initiating device self-tests.
S.M.A.R.T. is a system in modern hard drives designed to report conditions that may indicate impending failure. smartmontools is a free software package that can monitor S.M.A.R.T. attributes and run hard drive self-tests. Although smartmontools runs on a number of platforms, I will only cover installing and configuring it on Linux.
Smartctl Self-Monitoring, Analysis and Reporting Technology is designed to perform smart operations from the command line such as initiating device self-tests and printing smart self-test etc. Using smartctl a user can read the smart information from the hard disk and can perform tests on the SSD or hard drive to detect any problems with the hard drive or SSD.
Installation of Smartctl
- Update your apt cache which is a recommended step if you are using Ubuntu
sudo apt update -y
- Update your system with running this command if you are using CentOS/RHEL
sudo dnf update -y
- Install the smartmontools package which has the smartctl program if you are using Ubuntu
sudo apt install smartmontools -y
- Install smartmontools if you are using CentOS/RHEL
sudo dnf install smartmontools -y
- Check whether our drive is a smart type or not.
sudo smartctl -i /dev/sda
- To enable the smartctl so that smartctl always starts whenever the system reboots, run this command below
sudo smartctl -s on /dev/sda
Note: smartctl can perform different hard drive tests and can analyze a problem with our drive so first let us go with checking our hard drive health by executing the command below
smartctl -H /dev/sda
- To verify the test mode on hard drive
smartctl -H /dev/vda
- To run a short test on the HDD
smartctl -test=short /dev/vda
- Also To run a long test on our HDD
smartctl -test=long /dev/vda
- Display Error logs of the disk
smartctl -l error /dev/sda
- make sure that the drive supports self-tests
smartctl -c /dev/sda
- You can run to self test check results
smartctl -l selftest /dev/sda
- If you want to uninstall smartctl utility, run this command
sudo apt remove smartmontools
In this tutorial, we has installed and configured smartctl utility, The Smart tool that helps us in monitoring the hard drives and detecting any faults or problems.