Hardisk test helps to prevent data loss before it actually fails. It shows bad sector and any other problem like
A standard S.M.A.R.T method is supported by many harddisks which help to gather info easily.
Installation
You can install the smartmontools package from the Synaptic Package Manager (see SynapticHowto), or by typing the following into the terminal:
sudo apt-get install smartmontools
Checking a drive for SMART Capability
To ensure that your drive supports SMART, type:
sudo smartctl -i /dev/sda
where /dev/sda is your hard drive. This will give you brief information about your drive. The last two lines may look something like this:
SMART support is: Available - device has SMART capability. SMART support is: Enabled
Enabling SMART
In the case that SMART is not enabled for your drive, you can enable it by typing:
sudo smartctl -s on /dev/sda
You may run any type of test while the drive is mounted although there may be some drop in performance. There are three types of test that can be conducted on a drive:
Short
Extended (Long)
Conveyance
To find an estimate of the time it takes to conduct each test, type:
sudo smartctl -c /dev/sda
The most useful test is the extended test (long). You can initiate the test by typing:
sudo smartctl -t long /dev/sda
You can view a drive's test statistics by typing:
sudo smartctl -l selftest /dev/sda
To display detailed SMART information for an IDE drive, type:
sudo smartctl -a /dev/sda
To display detailed SMART information for a SATA drive, type:
sudo smartctl -a -d ata /dev/sda
Note: This also works for IDE drives in new kernels that are being run through the SCSI stack and show up as /dev/sdX
https://help.ubuntu.com/community/Smartmontools