How to check the health of a hard drive
sudo smartctl -a /dev/sda | less
This will give you an abundance of information about your hard drive's health. The tool also permits you to start and monitor self tests of the drive.
If you want to do benchmarks / check all of the sectors to find one that is bad, you can find other tools for that, but smartctl is the first place to go for drive health status.
badblocks is one more useful utility; it shows the amount and location of bad blocks on your drive:
sudo badblocks -v /dev/sda
If a HD starts to give you physical hints about an upcoming failure, no software will help. Yes, SMART exists and things like smartctl can read its results for you, but you shouldn't bet on it. SMART can be useful for detecting things like high temperatures or bad sectors, but if your HD starts to click or does not start up during the first try, it's time to
- make sure you have backups
- rush to nearest computer dealer, buy a new HD and copy everything there
When HD decides to fail, it will do it without a previous warning and Murphy's law says that the failure will happen during the most unwanted moment. So be prepared and backup & replace the disk NOW rather than waiting for the catastrophe.
I see that no one has mentioned gsmartcontrol
which is a GUI.
In Ubuntu you can install it with $ sudo apt-get install gsmartcontrol
If you launch sudo gsmartcontrol
you see all the hard drives in your computer.
Then if you right click on a device and click View Details
you see something like this.
You can get a lot of details in the different tabs here. You can also perform tests in the Perform Tests
tab.
Try using SpinRite (It isn't free) but I have used many, many tools. Most tools make more damage than help, when I say damage, I mean "not taking good care of your information". This tool will check your drive and fix the bad sectors, while moving your information to secure sectors. It also is a preventing method for hard disk catastrophes
I strongly suggest risking on buying a fully tested product with a good background, than losing your so valuable information.