SMART utilities
From smartctl(8):
"the Self-Monitoring, Analysis and Reporting Technology (SMART) system [is] built into many ATA-3 and later ATA, IDE and SCSI-3 hard drives. The purpose of SMART is to monitor the reliability of the hard drive and predict drive failures, and to carry out different types of drive self-tests"
The smartctl (and smartd) programs belong to the smartmontools package.
smartctl -a /dev/hdX will report on a disk's self-monitoring data, to reveal signs of impending failure. It will also print the results of self-tests performed by the drive.
smartctl -t long /dev/hdX will initiate an extended self test.
For Linux libata disks (e.g. SATA devices treated as SCSI devices, i.e. those named /dev/sdX) you need to add -d ata to the smartctl command line.