For system, network and cloud administrators

How to check your disk’s health in Linux using smartmontools?

How to check your disk's health in Linux using smartmontools?

What is smartmontools?

The smartmontools package contains two utility programs (smartctl and smartd) to control and monitor storage systems using the Self-Monitoring, Analysis and Reporting Technology System (SMART) built into most modern ATA/SATA, SCSI/SAS and NVMe disks. In many cases, these utilities will provide advanced warning of disk degradation and failure.

— Official description from smartmontools.org

Ubuntu 20.04

  1. Install smartmontools by typing into your terminal:
sudo apt-get install smartmontools -y
  1. Get information about your disk:

Once smartmontools has been installed, it can be used by using the smartctl command where /dev/sda needs to be replaced with your own corresponding disk letter. The result of the test, we’ll put it into a file called 00_sda_output.txt.

sudo smartctl --all /dev/sda >> 00_sda_output.txt
  1. Read the information about your disk:
cat 00_sda_output.txt
How to check your disk's health in Linux using smartmontools? Seagate 500GB 2.5 in laptop thin HDD.
Seagate 500GB 2.5 in laptop thin HDD
How to check your disk’s health in Linux using smartmontools? Crucial SSD BX500
Crucial SSD 1TB 2.5 in. BX500

Notice how the result will display if your disk has the SMART capability enabled.

In case your disk does not have the SMART capability enabled, you can enabled it by typing:

sudo smartctl -s on /dev/sda 
  1. Test your disk:

The disk can be tested in 3 ways: short, long or conveyance. But to get an estimate of how much time each test will take for your disk, type:

sudo smartctl -c /dev/sda 
How to check your disk's health in Linux using smartmontools?
Estimated time for each disk test type (Seagate 500GB 2.5 in thin HDD, Zorin OS 15.3)
How to check your disk’s health in Linux using smartmontools? Crucial SSD 1TB 2.5 in BX500.
Estimated time for each disk test (Crucial SSD 1TB 2.5 in BX500, Lubuntu 20.04.2 LTS)
  • Testing your disk, the short way:
sudo smartctl -t short /dev/sda
How to check your disk's health in Linux using smartmontools?
Doing a short disk test (Seagate 500GB 2.5 in thin HDD, Zorin OS 15.3)

View your test:

sudo smartctl -l selftest /dev/sda
How to check your disk's health in Linux using smartmontools?
Viewing the results of a short disk test (Seagate 500GB 2.5 in thin HDD)
Viewing the results of a short disk test (Crucial SSD 1TB 2.5 in BX500)
  • Testing your disk, the long way:
sudo smartctl -t long /dev/sda

View your test:

sudo smartctl -l selftest /dev/sda
How to check your disk's health in Linux using smartmontools?
Viewing the progress of a long disk test (Seagate 500GB 2.5 in thin HDD)
How to check your disk’s health in Linux using smartmontools? The results of a long disk test.
Viewing the results of a long disk test (Seagate 500GB 2.5 in thin HDD)
How to check your disk’s health in Linux using smartmontools? View long disk tests (Crucial SSD 1TB 2.5 BX500).
Viewing the results of a long disk test (Crucial SSD 1TB 2.5 BX500)

Leave a Reply

Your email address will not be published. Required fields are marked *