If you want to ensure that your computer performs optimally, it is crucial that your HDD / SSD performs well. Though laptops and desktops are very resilient, you should keep checking the health of the components to ensure the longevity. A data storage device is a core-component of any computer. The two main types are known as HDD aka Hard Disk Drive and SSD aka Solid-State Drive. The main differences between these two boils down to the price and the IO speeds.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Linux system performance queries.
In this context, we shall look into how you can check the health of your HDD/SSD in Ubuntu 20.04.
HDD / SSD Health checks can be performed via the GUI solution (GNOME Disks) as well as through a command line tool.
1. Checking HDD / SSD Health via the interface
Here, you can perform the tests without much knowledge of terminal commands.
i. You can start by opening up the "Disks" Application.
ii. You can either start by pressing the "window" key or by clicking on "Activities" in the upper left corner of the screen.
iii. When the text box for search pops up, type "Disks", now click on the icon and launch the application.
iv. Once the application opens up, it will list the data storage devices in your computer.
v. Then, Select the HDD/SSD you want to test. Now:
In the window that opens up, you’ll be able to see the status of your data storage device.
If there are multiple storage devices, you can go back to the previous window and select the other device to test it.
2. Checking HDD / SSD Health via the terminal
Via the terminal, you'll need to start by installing the SmartCtl package. In your terminal, type the following:
$ sudo apt-get install smartmontools -y
Once done, you'll need to start the service through the following command:
$ systemctl start smartd
Since you need the service running, you need to check the status of the service before running any tests. Type this command to check the status:
$ systemctl status smartd
Once the service has been started, get the information of your hard drive through the following command:
$ sudo smartctrl -i /dev/sda
Now you can launch a short test, using the following command:
$ sudo smartctl -t short -a /dev/sda
Through this short test, you'll test the electrical and mechanical properties along with read/verify.
Also, you can run a long test, using the following command:
$ sudo smartctl -t long -a /dev/sda
Through this long test, you'll get everything included in the short test along with much more.
If you want to inspect the overall health of your data storage device, type and run the following:
$sudo smartctl -d ata -H /dev/sda
You'll get the following short output, and rather than stats, you'll see if the test passed or failed.
If you want to explore all the possible options you can use with the smartctl command, you can pull it up by using the following:
$smartctl --help
You'll get all the arguments and parameters you can mix and match to customize the tests as extensive and comprehensive as possible.
This article covers the different ways to check the health of your Hard Disk Drives and Solid-State Drives. In fact, SMART (Self-Monitoring, Analysis, and Reporting Technology) is a feature enabled in all modern hard disk drives and SSDs to monitor/test reliability. It checks different drive attributes to detect the possibility of drive failure.
What is the need to check Linux system SSD and HDD drives ?
If you are a system administrator and responsible for managing Linux systems in Datacenter. Then, it is recommended to check the health of the SSD and HDD drives regularly. It will help you to identify failed drives and they can be replaced before any data loss occurs. S.M.A.R.T is a tool used to monitor the health status of SSD and HDD. It also allows you to perform on-demand tests on the drive.
How to Test SSD Health using Smartctl ?
Smartctl is a command-line utility tool that can be used to check S.M.A.R.T-enabled HDD or SSD status in the Linux system.
Smartctl utility tool comes with the package smartmontools. Smartmontools is available by default in all Linux distributions including Ubuntu, RHEL and Centos and Fedora.
To install smartmontools in Linux, run the below command:
$ sudo apt install smartmontools
To Start Smartmontools service, execute the below command:
$ sudo /etc/init.d/smartmontools start
Smartd service will start automatically after the successful installation.
If not started, start smartd service:
$ sudo systemctl start smartd