1. Home
  2. Linux
  3. Check hard drive health on linux

How to check hard drive health on Linux

Hard drive failure on Linux is a lot less common these days because many Linux fans know a lot about their hard drives. However, no hardware is invincible, and accidents do happen. For this reason, it’s a good idea to keep a check on your hard drive health and take preventive measures if something is wrong.

Checking your hard drive health is quite easy with the right tools. In this article, we’ll go over two quick ways to take a look at hard drives on Linux and check their health status.

1. Smartctl

Modern hard drives have “S.M.A.R.T..” It’s a feature that allows operating systems (like Linux, Mac, and Windows) to verify the integrity and health of the hard drives.

Note: the fastest way to check if your drive has “S.M.A.R.T.” features is to take it out of your computer and read the information on the label. Alternatively, check the box it came in.

Install Smartmontools

On Linux, there are many ways to check the S.M.A.R.T. status of a hard drive. However, probably the quickest way is with smartctl. Before we can go over how to use this tool, we must give instructions on how to check the health of your hard drives with smartlctl.

To install the Smartmontools, open up a terminal and follow the instructions that correspond with your Linux distribution.

Ubuntu

sudo apt install smartmontools

Debian

sudo apt-get install smartmontools

Arch Linux

sudo pacman -S smartmontools

Fedora

sudo dnf install smartmontools

OpenSUSE

sudo zypper install smartmontools

Generic Linux

As the Smartmontools bundle of programs is one of the main ways to check hard drive health under Linux, there’s a good chance even the most unknown of distributions will be able to install it. To get it, open up a terminal window, search for “smartmontools” and install it how you usually install programs. It is also possible to grab Smartmontools (via source code) from the official website.

Hard drive health – Smartctl

Smartctl is quite easy to use. To check the health of your hard drive with it, follow these steps.

Step 1: Open up a terminal and gain a root shell with su or sudo -s.

su -

Step 2: List the hard drives attached to your Linux PC with the lsblk command. Keep in mind that /dev/sdX is the device label, and /dev/sdX# means partition number.

lsblk

Step 3: Look through your drive listing, and find the drive you’d like to check. Once you’ve found it, highlight it with the mouse, and take note of it.

Step 4: In the terminal, use the smartctl command to print out the S.M.A.R.T. status of your device. Be sure to change the “X” with your drive’s label name.

smartctl -a /dev/sdX

Look through the output and determine the health of your drive. Be sure to repeat this process if you have multiple hard drives.

Need to save the smartctl drive report for later? Pipe it to a file with the command-below!

smartctl -a /dev/sdX >> /home/username/Documents/drive-report.txt

Gnome Disks

If you’re not a huge fan of the terminal, but still need to check the health of your hard drive on Linux, consider using Gnome Disks. It includes several S.M.A.R.T. features, including basic health checking, and testing features for both spinning drives and SSDs.

To get your hands on Gnome Disks, open up your application menu, search for “Disks” and launch it. Or, if you do not have it installed, follow the instructions below for your operating system.

Ubuntu

sudo apt install gnome-disk-utility

Debian

sudo apt-get install gnome-disk-utility

Arch Linux

sudo pacman -S gnome-disk-utility

Fedora

sudo dnf install gnome-disk-utility

OpenSUSE

sudo zypper install gnome-disk-utility

Generic Linux

Gnome Disks is a core part of the Gnome desktop. It can be found on all operating systems that distribute Gnome, Gnome Shell and its software. If you need to install it on your OS, and can’t find it, the source code is available online.

Hard drive health –  Gnome Disks

Launch the Gnome Disk application your Linux PC. When it opens up, it’ll automatically select the first hard drive connected to your computer (usually the one using Slot0/Slot1 in the SATA port on the motherboard).

At a glance, it is possible to view S.M.A.R.T. information of the hard drive, by looking at the “assessment” section of Gnome Disks.

For a complete readout of your hard drive’s S.M.A.R.T. data and overall health, press Ctrl + S on the keyboard.

Pressing the Ctrl + S combination brings up an S.M.A.R.T. dashboard that prints out (in easy to read terms) all of the errors and issues the selected hard drive is experiencing.

Run tests

Need to test your drive? Open the S.M.A.R.T. dashboard in Gnome Disks, then click the “Self-test” option to run basic hard drive health tests.

5 Comments

  1. Hi,

    Your article was very helpful.

    Let Me know how can i check the Health of HDD or SATA drive.
    Shall i use the smartctl tool?

    Thanks,
    Mohd Habeeb Ur Rehman