Testing your hard drives with SMART – Linux
SMART Testing on drives is a great way for checking their overall health however it should not be used exclusively to confirm if a disk is healthy or not. This guide details some commands that can be ran to check the status of your drive using SMART.
You can also use smartmon tools to get information such as serial numbers for when you need to know exactly which physical drive you are replacing.
Use your Linux distribution’s package manager to install
yum install smartmontools
apt-get install smartmontools
Getting Serial Numbers of disks
Run these on a terminal.
smartctl -i /dev/name_of_drive
smartctl -i /dev/sda
You will want the serial of a drive if you were replacing and needed to know which physical drive it is, for example in a RAID setup. This will also show your the SMART status of the drive.
Running SMART tests
There are various SMART tests available to us, check how long the SMART tests will take with the following command (in this example for the hard disk /dev/sdc):
smartctl -c /dev/name_of_drive
# smartctl -c /dev/sda Short self-test routine recommended polling time: ( 2) minutes. Extended self-test routine recommended polling time: ( 83) minutes. Conveyance self-test routine recommended polling time: ( 5) minutes.
Run the test in background mode:
smartctl -t short|long|conveyance /dev/name_of_drive
Example of a short test
smartctl -t short /dev/sda
You can view the SMART status as follows:
smartctl -a /dev/sda
Or the following command can also be used, if only the test results should are displayed
smartctl -l selftest /dev/sdc