[email protected]Office hours: Mon – Fri 9:00AM – 5:00PMLinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedFebruary 21, 2023

How to Install Smartctl on Ubuntu 20.04 – Monitor the health of your hard disks

How to Install Smartctl on Ubuntu 20.04 – Monitor the health of your hard disks

As mentioned above, the smartctl command belongs to the smartmontools utilities that we can install from the official repositories of Ubuntu 20.04. To achieve this, open a terminal or SSH session.

Then, you can update the system

sudo apt update

sudo apt upgrade

Now you can install all the tools with the command

sudo apt install smartmontools

Then we have the commando available for us to use.

 

Using the Smartctl command on Ubuntu and check the health of the hard drive

The first thing we have to do is to run the command as root user. Either you do the commands as root user or using sudo.

To use it, you have to run this command

sudo smartctl -i [disk]

So, you have to replace [disk] with the path of the hard disk. For example:

sudo smartctl -i /dev/sda

From this screen output, pay attention to the last two that indicate if SMART support is enabled.

SMART support is: Available – device has SMART capability.

SMART support is: Enabled

In case the support is not enabled, you have to enable it with the following command:

sudo smartctl -s on -d ata /dev/sda

Remember to replace /dev/sda/ with the path of your device.

Now we can start a test to the hard disk. This can be long or short, depending on us. For a long test, run.

smartctl -t long /dev/sda

And for a short one

smartctl -t short /dev/sda

The same command will tell us how long we have to wait to verify the test, for example, this is the output I got:

smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.13.0-44-generic] (local build)

Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===

Sending command: “Execute SMART Short self-test routine immediately in off-line mode”.

Drive command “Execute SMART Short self-test routine immediately in off-line mode” successful.

Testing has begun.

Please wait 2 minutes for test to complete.

Test will complete after Wed Jun 1 16:28:30 2022 -04

Use smartctl -X to abort test.

Then, verify the test result with the following command:

sudo smartctl -l selftest /dev/sda

In my case, the disk has no error:

# 1 Short offline Completed without error 00% 1143 –

If there are errors, you can see them, and you will be given some recommendations.

 

Uninstalling the smartctl command

If you no longer want to use it, the best thing to do is to uninstall it from the system. To achieve this, just run.

sudo apt remove smartmontools

And that’s it.

Keep reading
How to Implement Network Segmentation and Resource Isolation in Linux.
February 6, 2024

How to Implement Network Segmentation and Resource Isolation in Linux.

How to Implement Network Segmentation and Resource Isolation in Linux. Securing and managing networks in a Linux environment involves advanced practices like network segmentation and resource isolation. This guide explores these concepts, providing detailed instructions and examples for…

Read article
How to open or close ports in Linux.
February 6, 2024

How to open or close ports in Linux.

How to open or close ports in Linux. Effectively managing ports on your Linux system is crucial for both security and service accessibility. This comprehensive guide will provide a detailed walkthrough on opening and closing ports using the robust tools iptables and ufw. Understanding these…

Read article
How to use ypdomainname command.
January 23, 2024

How to use ypdomainname command.

How to use ypdomainname command. In the realm of Linux networking, the ypdomainname command plays a crucial role in the context of the Network Information Service (NIS). NIS, formerly known as Yellow Pages, is a distributed database service that facilitates the sharing of network configuration and…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, colocation, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Office hours: Mon – Fri 9:00AM – 5:00PM