That's possible with the SmartMonTools. You can install them under every current distribution with the package manager.
They are also available from the RescueSystem.
For P-ATA disks (Value series):
smartctl -a /dev/hda
(for further disks use /dev/hdb etc.)
For S-ATA disks (Instand64 series):
smartctl -d ata -a /dev/sda
or
smartctl -d sat -a /dev/sda
(for further disks use /dev/sdb etc.)
Further information regarding SmartMonTools can be found at:
- http://smartmontools.sourceforge.net/
- http://www.linux-user.de/ausgabe/2004/10/056-smartmontools/ (German only)
The message " SMART overall-health self-assessment test result: PASSED" in the upper third indicates a correctly working HDD.
Error diagnostics via SMART self test:
- Short Selftest (takes a few minutes)
PATA: smartctl -t short /dev/hda
SATA: smartctl -d ata -t short /dev/sda or smartctl -d sat -t short /dev/sda
The estimated duration of the test is displayed to you after executing the command.
- Long Selftest (takes a few hours)
PATA: smartctl -t long /dev/hda
SATA: smartctl -d ata -t long /dev/sda or smartctl -d sat -t long /dev/sda
The estimated duration of the test is displayed to you after executing the command.
- Analysis of the self test:
PATA: smartctl -l selftest /dev/hda
SATA: smartctl -d ata -l selftest /dev/sda or smartctl -d sat -l selftest /dev/sda
Output of a defective HDD:
# smartctl -d ata -l selftest /dev/sdb
smartctl version 5.37 [x86_64-suse-linux-gnu] Copyright (C) 2002-6 Bruce Allen Home page is http://smartmontools.sourceforge.net/
=== START OF READ SMART DATA SECTION ===
SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(h) LBA_of_first_error
# 1 Short offline Completed: unknown failure 90% 6 -
# 2 Extended offline Completed: unknown failure 90% 3 -
Output of an intact / error-free HDD:
# smartctl -l selftest /dev/hda
smartctl version 5.37 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen Home page is http://smartmontools.sourceforge.net/
=== START OF READ SMART DATA SECTION ===
SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(h) LBA_of_first_error
# 1 Short offline Completed without error 00% 7499 -
# 2 Short offline Completed without error 00% 7477 -
# 3 Short offline Completed without error 00% 7454 -
# 4 Short offline Completed without error 00% 7432 -
# 5 Short offline Completed without error 00% 7409 -
# 6 Extended offline Completed without error 00% 7388 -
A constant diagnosis is possible via SMARTD Daemon. It conducts short and long self tests (depending on the configuration) and warns the administrator in a problem case so that there's enough time left to react.
Since this is a function for advanced users we recommend consulting the How-tos and information of the respective Linux distribution.