Webmasters monitor the current status and health of hard drives via the SMART attributes. Install smartctl on Linux is pretty similar for various distributions.
As a part of our Server Management Services, we help our Customers with software installations regularly.
Let us today discuss the steps to install smartctl on Linux.
Installation of SmartCTL on CentOS 7
We can install Smartctl easily with the following command:
# yum install smartmontools
Once the installation is complete, enable it to starts when the server reboots with the command below:
# systemctl enable smartd
Now, we can start the service and check its status with the commands given below:
# systemctl start smartd
# systemctl status smartd
Installation of SmartCTL on Ubuntu
The installation of smartctl on Ubuntu similar to that on CentOS. We could install it on Ubuntu with the command below:
# apt-get install smartmontools
The steps to enable/start smartctl and the user commands on Ubuntu are the same as they are on CentOS.
Usage of smartctl
Smartctl can perform various hard drive tests. We can analyze a faulty drive or perform an ATA/SCSI test based on our HDD type.
The following command helps us to check if smartctl is enabled.
# smartctl -i /dev/vda
Replace “/dev/vda” with the correct disk label which can be obtained from the output of df -h command. A sample output of the above command will look like this.
smartctl 7.0 2018-12-30 r4883 [x86_64-linux-3.10.0-1127.19.1.el7.x86_64] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Vendor: QEMU
Product: Vz HARDDISK0
Revision: 2.5+
Compliance: SPC-3
User Capacity: 42,949,672,960 bytes [42.9 GB]
Logical block size: 512 bytes
LU is thin provisioned, LBPRZ=0
Serial number: e603b97ac34343e582bb
Device type: disk
Local Time is: Tue Oct 6 15:37:02 2020 EEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
The last two lines of this output highlighted in the image below indicates that smartctl is enabled for the drive.
If the output indicates that SMART support is available, but not enabled, we can run this command to enable it.
# smartctl -s on -o on -S on /dev/vda
Disable smartctl
To disable SMART capabilities on the hard drive, we can use this:
# smartctl -s off /dev/vda
Check Drive Health
To display the overall health of the hard drive, we can use this one:
# smartctl -H /dev/vda
Our output will look like this:
smartctl 7.0 2018-12-30 r4883 [x86_64-linux-3.10.0-1127.19.1.el7.x86_64] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
SMART Health Status: OK
Verify Test Mode
To make sure that drive is capable of running tests on its own, we can use this one:
# smartctl -H /dev/vda
Run Long/Short Test
When we want to run a short or long test on the HDD, we can use these two commands:
# smartctl –test=short /dev/vda
# smartctl –test=long /dev/vda
[Need any further assistance to install smartctl? – We’re available 24*7]
Conclusion
In short, the SMART test helps us to detect any potential problems with the hardware. Today, we saw how our Support Engineers install smartctl on Centos and Ubuntu distros.
0 Comments