This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.

Please visit our production wiki at https://wiki.gentoo.org

smartmontools

From Gentoo Wiki (test)
Jump to:navigation Jump to:search

Resources

smartmontools is a utility to read and monitor the S.M.A.R.T. (Self-Monitoring, Analysis and Reporting Technology) information of ATA/SATA and SCSI/SAS drives.

Installation

Hardware

S.M.A.R.T. support needs to be enabled in the BIOS or EFI firmware for correct operation.

USE flags

USE flags for sys-apps/smartmontools Tools to monitor storage systems to provide advanced warning of disk degradation

+daemon Install the monitoring daemon (smartd) and associated scripts.
+update-drivedb Install a script to update the drivedb file.
caps Build against sys-libs/libcap-ng to allow smartd to drop its privileges.
selinux  !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur
static  !!do not set this during bootstrap!! Causes binaries to be statically linked instead of dynamically
systemd Enable use of systemd-specific libraries and features like socket activation or session tracking

Emerge

Install sys-apps/smartmontools:

root #emerge --ask sys-apps/smartmontools

Usage

Invocation

root #smartctl -h

Examples

smartctl is a utility that is used to control and monitor S.M.A.R.T. enabled drives.

Print information of a drive, including S.M.A.R.T. support:

root #smartctl -i /dev/sda

Enable S.M.A.R.T. on a drive:

root #smartctl -s on /dev/sda

Print the S.M.A.R.T. health status of a drive:

root #smartctl -H /dev/sda

If the result is PASSED, the drive is in good health. If the result is FAILED, drive failure is imminent and the data should be backed up.

Print the S.M.A.R.T. capabilities of a drive, including supported tests and the time required to run them:

root #smartctl -c /dev/sda

Print the vendor specific S.M.A.R.T attributes of a drive:

root #smartctl -A /dev/sda

Run a S.M.A.R.T. test on a drive:

root #smartctl -t TEST /dev/sda

The possible values for TEST include:

  • offline: Run the S.M.A.R.T. Immediate Offline Test.
  • short: Run the S.M.A.R.T. Short Self Test.
  • long: Run the S.M.A.R.T. Extended Self Test.
  • conveyance: Run the S.M.A.R.T. Conveyance Self Test.

Print a S.M.A.R.T. log of a drive:

root #smartctl -l LOG /dev/sda

The possible values for LOG include:

  • error: Print the S.M.A.R.T. error log. This log will contain all errors. If the result is No Errors Logged, the drive is in good health. If there are some old errors, the drive is most likely in good health. If there are many recent errors, drive failure may be imminent and the data should be backed up.
  • selftest: Print the S.M.A.R.T. self-test log. This log will contain the results for the short, long and conveyance tests.

S.M.A.R.T. daemon

smartd is a daemon that continuously monitors the S.M.A.R.T. information of drives. It can be configured via /etc/smartd.conf. See man smartd.conf for more information. smartd will log any errors to /var/log/messages.

In this example smartd monitors 4 drives and sends a test e-mail on startup. It also runs a scheduled test every week on Friday at 3:00 a.m.

FILE /etc/smartd.conf
/dev/disk/by-id/ata-ST3000DM001-000000_00000000 -m alerts@example.com -M test -H -l error -l selftest -f -s L/../../5/03
/dev/disk/by-id/ata-ST3000DM001-111111_11111111 -m alerts@example.com -M test -H -l error -l selftest -f -s L/../../5/03
/dev/disk/by-id/ata-WDC_WD20EARS-00MVWB0_WD-000000000000 -m alerts@example.com -M test -H -l error -l selftest -f -s L/../../5/03
/dev/disk/by-id/ata-WDC_WD20EARS-00MVWB0_WD-111111111111 -m alerts@example.com -M test -H -l error -l selftest -f -s L/../../5/03

To start smartd:

root #/etc/init.d/smartd start

To start smartd at boot:

root #rc-update add smartd default

External resources