Disks are one of the most important parts of the storage category. The disk health is really important. They hold numerous data – important and non-important. The OS is also installed in the system. Any issue in the disk drive can lead to serious issues like data corruption or system crash. For Linux systems, there’s an awesome daemon (helper program) available that can check out the physical drive for any issue and report to you. Thus, you can follow precautionary steps to prevent any type of potential problems in the upcoming future.
What is S.M.A.R.T.?
In today’s world, most of the physical hard drives (HDD and SSD) integrates a nice feature called “S.M.A.R.T.”, meaning “Self-Monitoring Analyzing and Reporting Technology”. This tech gathers valuable information about the health of the drive. By using the tool, you’ll become concerned and mark your next steps.
For using the technology, we will be using “smartd”.
For installing the software, run the codes according to your Linux distro. This tool doesn’t come up by default on your system.
Run this command in the terminal:
sudo yum install smartmontools
Ubuntu + Ubuntu-based distros
If you’re running Ubuntu or other Ubuntu-based distros, use this command in the terminal:
sudo apt-get install smartmontools
Verifying the S.M.A.R.T. capability
Before using the software, you have to ensure that your device is capable of it. Run this command in the terminal:
smartctl -i /dev/sda
The line “SMART support is: Available – device has SMART capability” will ensure that your device is capable of S.M.A.R.T technology. “SMART support is: Enabled” means that the tech is enabled on your device.
If you don’t have the luck, you won’t have the SMART capability. But most likely, you won’t run into this problem unless your hardware is really old.
Configuring the “smartd” for running on selective disk(s) only
There is a system that you can use to configure the tool for scanning specific devices only. You can edit the “/etc/smartd.conf” file for configuring the facility. Here, I’ll be showing the example using “/dev/hda”.
# cat /etc/smartd.conf /dev/hda -a -m [email protected]ost.localdomain ...
After completing the edit, restart the daemon service.
# /sbin/service smartd restart Shutting down smartd: [ OK ] Starting smartd: [ OK ]
If you want to start the process at every time during the boot, run this command:
chkconfig on smartd
For RHEL/CentOS, use these commands:
systemctl enable smartd systemctl start smartd
Using “smartd” for checking bad sectors or disk errors
There are lots of abilities that the daemon tool can perform. Run this command to check out for any disk error or bad sector. Here, the example is “/dev/sdd”.
# smartctl -H /dev/sdd
For learning the result(s) of the scan(s), use this command:
# smartctl -a /dev/sdd
There are tons of other available options for advanced users. If you want to learn more about the settings of “smartd”, run this command in the terminal:
Note that your hard drive is always susceptible to bad sectors and other issues, no matter how safely you use. Enjoy your healthy hard drive!