smartctl: command not found

The smartmontools project produces a SMART monitoring daemon called smartd and a command-line utility called smartctl, which can do most things on demand that the daemon does in the background periodically. With these tools, along with standard Linux filesystem utilities such as debugfs and tune2fs, there aren’t many hard drive issues you can’t fix.

But before you can repair anything or transform yourself into a seemingly superpowered hard-drive hero with powers on loan from the realm of the supernatural, you have to know what’s going on with your drives, and you need to be alerted to changes in the status of the health of your drives.

First, you should probably get to know your drives a bit, which smartctl can help out with. If you know that there are three drives in use on the system, but you’re not sure which one the system is labeling /dev/hda, run the following command:

# smartctl -i /dev/hda

You might get below error while running the smartctl command:

smartctl: command not found

In taht case you may try installing below package as per your choice of distribution:

Distribution Command
OS X brew install smartmontools
Debian apt-get install smartmontools
Ubuntu apt-get install smartmontools
Alpine apk add smartmontools
Arch Linux pacman -S smartmontools
Kali Linux apt-get install smartmontools
Fedora dnf install smartmontools-1
Raspbian apt-get install smartmontools

smartctl Command Examples

1. View SMART health summary:

$ sudo smartctl --health /dev/sdX

2. View device information:

$ sudo smartctl --info /dev/sdX

3. Begin a short self-test:

$ sudo smartctl --test short /dev/sdX

4. View current/last self-test status and other SMART capabilities:

$ sudo smartctl --capabilities /dev/sdX

5. View SMART self-test log (if supported):

$ sudo smartctl --log selftest /dev/sdX

6. Enable and disable smartctl for each disk you want to monitor:

$ sudo smartctl -s on /dev/sda
$ sudo smartctl -s off /dev/sda

7. Use the -x flag for a complete data dump:

$ sudo smartctl -x /dev/sda

Conclusion

smartmontools is provided by the smartmontools package. It should install and start a systemd service automatically, which you can check with systemctl:

$ systemctl status smartd.service   ## for a RedHat based distribution

Use the smartctl command to see if your disk has S.M.A.R.T. support.

Related Post