Since data security is a very important issue in server management, the health status of storage devices should be kept track of to guarantee data is properly backed up before they fail. This article will discuss how to monitor health of hard disks or SSDs on Linux server.
S.M.A.R.T.
S.M.A.R.T. (Self-Monitoring, Analysis, and Reporting Technology) is a supplementary component built into many modern storage devices through which devices monitor, store, and analyze the health of their operation. Statistics are collected (temperature, number of reallocated sectors, seek errors…) which software can use to measure the health of a device, predict possible device failure, and provide notifications on unsafe values.
Smartmontools
The smartmontools package contains two utility programs for analyzing and monitoring storage devices: smartctl and smartd. Pre-built binary package could be used to install smartmontools. Installation method differentiates depends on the Linux distribution used. On RHEL/Fedora, use following command to install the package.
1 | # yum install smartmontools |
Using smartctl to dump S.M.A.R.T. information
Devices connected directly
1 | # smartctl -a /dev/sda |
Devices connected via bridge controller
Device type should be specified explicitly by the -d option for storage devices connected via bridge controller such as USB to SATA controller.
1 | # smartctl -a -d sat /dev/sda |
Devices connected with RAID controller
For storage devices connected with LSI MegaRAID controller, get the device ID by the storcli utility first. You can download this utility on the LSI’s website.
1 | # storcli64 -pdlist -a0 |
Then use smartctl with the -d megaraid,<Device ID> option.
1 | # smartctl -a -d megaraid,23 /dev/sdb |
For SATA devices, it may prompts following warnings.
1 | /dev/sdb [megaraid_disk_23] [SAT]: Device open changed type from 'megaraid' to 'sat' |
Just as it prompts, use -d sat+megaraid,<Device ID> instead.
1 | # smartctl -a -d megaraid,23 /dev/sdb |
Refer to the smartctl manual page for other type of RAID controller.
Author: B.H.Zhao
URL: https://blog.zbhitech.com/monitor-storage-device-health-on-linux-server/
Copyright: This article is licensed under CC BY-NC-ND 4.0.