Disk health is an important matter. Your storage media has a useful lifespan and the clock is ticking it from day one. Either hard disk drive (HDD) or solid state drive (SSD), your storage media has a limited lifespan.
You should plan on your drives failing because, given enough time or use, they will fail. This is a known limitation and there are ways to monitor disk health. Heck, in theory, many systems are supposed to monitor disk health and alert you of impending failure (see some BIOS options), though I’ve personally had poor luck relying on automated alerts. I periodically perform manual disk health checks.
We’ll be using “S.M.A.R.T.” (Self-Monitoring Analysis and Reporting Technology) and “smartmontools” for this exercise. It’s actually pretty accurate data – sorta… If it tells you there’s a problem, chances are good that drive health is an issue. However, drives are perfectly happy failing without giving you any warning at all. As I said in the opening paragraph, there’s a limit to how long your drives will last – but it will eventually and certainly fail.
At the same time, there are probably many of us who have ‘magical’ drives. I have an external HDD that gets used constantly – and it’s well over a decade old. On the other end of the spectrum, I’ve had drives fail within weeks of the warranty ending – and sometimes before the warranty ended. Drive failure is real and you should be prepared for it. The best way to be prepared for it is to have spares and a good backup plan.
So, let’s get started! (Also, click on the Wikipedia link above.)
As I said above, we’ll be using ‘smartmontools’ to check the disk health with S.M.A.R.T. reporting. It’s a fairly robust application and is available for the major distros. Smartmontools is easily installed with your package manager, or you can do it in the terminal. If you want to do that, first open the terminal with
sudo apt install smartmontools
sudo dnf install smartmontools
sudo pacman -S smartmontools
Any of those will work on the appropriate systems. If you use a distro that’s not listed, it’s probably available in your repositories. It’s a fairly common tool and disk health is important!
Anyhow, the tool you’ll be using from smartmontools is ‘smartctl’. It’s included with the package and is pretty easy to use. Read on to see how!
Check Disk Health With ‘smartctl’:
First, you should check to see if the device reports disk health by looking to see if the device has S.M.A.R.T. enabled. You can run this command:
sudo smartctl -i /drive/path
Where ‘/drive/path’, it’s often something like ‘/dev/sda’. You can look up your drive’s path easily enough. If it’s not enable, you can turn it on with:
sudo smartctl -s on /drive/path
Now, you can go ahead and check the status. To do that, you run:
sudo smartctl -a /drive/path
That should output some data. Remember how I highly recommended you click the Wikipedia link above? Well you should. The data in the report is fairly well-covered on the Wiki page. If you didn’t click it above, you can click now.
Anyways, the data in the report above might be old because the command may output some stale information. To refresh the data in the report, you can run a short (or long) test. In this first case, we’re going to run a short test (lasting 2 minutes or less) with this command:
sudo smartctl -t short /drive/path
Wait the couple of minutes as prompted and then run the original command again to get a report with the updated information:
sudo smartctl -a /drive/path
You can also run a long test. That’s done by changing the short to long, as in the command used above. It’s done like this:
sudo smartctl -t long /drive/path
That’ll take up to 10 minutes and you can check the results after that time has passed. Once again, you will simply run the same command you’ve been using all along:
sudo smartctl -a /drive/path
Anyhow, pay attention to the results in that report. They’ll give you a lot of information. You can check the results and technical details against the Wikipedia link. With that information in hand, you can keep a reasonable eye on your disk health.
There’s more to smartctl and even smartmontools, but not a whole lot that’s terribly interesting or important. Simply run
man smartctl and look through the options. The most interesting/valuable disk health checks are covered above, but there’s nothing wrong with knowing more about your tools.
You know, if you install ‘gnome-disks’ then you can just do all of this graphically. Chances are good that all the distros out there that have smartmontools also have gnome-disks. If that’s more your style, just install it and poke around. It’s right there in the ‘three dot’ menu. Like so:
But, that’d be cheating! It’d also be a much more basic article and where’s the fun in that? Nowhere. That’s where the fun isn’t. Seriously, the GUI method with gnome-tools works just fine for this if you’d prefer to go that route. Again, check your results against the Wikipedia link posted throughout the article.
Anyhow, there’s another article in the books. One more article said and done, in my attempt to keep this going for a full year. It has been pretty fun. This article is about disk health and reminds me that I need to write one about backing up your data. That’s good, ’cause it means I’ve still got all sorts of ideas for articles!
Don’t forget, you too can write articles. I don’t mind and it’d help me reach the year goal going!
Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.
EDIT: Edited on 06/29/23 to correct spelling.
Last Updated on June 29, 2023 by KGIII