Linux

Installing smartmontools in Linux: A Step-by-Step Guide

This guide will help you install the smartmontools utility on any Linux distribution to monitor drive health and prevent sudden failures.

Updated at February 16, 2026
5-10 minutes
Easy
FixPedia Team
Применимо к:Ubuntu 20.04+Debian 10+CentOS 7+Fedora 35+Arch Linux

Introduction / Why This Matters

smartmontools is a suite of utilities for monitoring the health of storage drives (HDD and SSD) using SMART (Self-Monitoring, Analysis and Reporting Technology) technology. SMART helps detect signs of wear, failures, or potential drive issues in advance, which is critical for preventing data loss.

After installing smartmontools, you will be able to:

  • View detailed disk health information (temperature, number of reallocated sectors, power-on hours, etc.).
  • Run built-in disk self-tests.
  • Receive warnings about impending failure.
  • Integrate monitoring into alerting systems (e.g., via Nagios, Zabbix).

This guide is suitable for all popular Linux distributions.

Requirements / Preparation

Before you begin, ensure that:

  1. You have terminal access with sudo privileges (or root).
  2. The disk you plan to monitor supports SMART technology (virtually all modern drives do).
  3. You have an internet connection for package installation (if working on an offline server, you will need to download packages manually).

⚠️ Important: For NVMe drives, use smartctl with special options. In this guide, we will cover the general case for SATA/SAS drives. For NVMe, see the Potential Issues section.

Step 1: Identify the Disk Name

First, you need to find out how your disk is represented in the system. Open a terminal and run:

lsblk

You will see a list of all block devices. Typically, the system disk is /dev/sda, and additional drives are /dev/sdb, /dev/sdc, etc. For NVMe drives, names look like /dev/nvme0n1.

Note down the name of the disk you want to monitor (e.g., /dev/sda). If you are unsure which disk is needed, check the mount point in the lsblk output or use sudo fdisk -l.

Step 2: Install the smartmontools Package

Installation is done via your distribution's package manager. Choose the command that matches your system:

For Debian/Ubuntu and derivatives (Linux Mint, Pop!_OS, etc.)

sudo apt update
sudo apt install smartmontools

For RHEL/CentOS 7/8 and derivatives (AlmaLinux, Rocky Linux)

sudo yum install smartmontools

For Fedora, RHEL 8+, CentOS Stream

sudo dnf install smartmontools

For Arch Linux and derivatives (Manjaro, EndeavourOS)

sudo pacman -S smartmontools

For openSUSE

sudo zypper install smartmontools

After running the command, the package manager will install the smartctl (main utility), smartd (background daemon), and documentation.

Step 3: Verify the Installation

Make sure the utility installed correctly:

smartctl --version

Expected output (version may vary):

smartctl 7.3 2022-02-28 r5145 [x86_64-linux-5.15.0-50-generic] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

If the command is not found, check if the package is installed and that /usr/sbin (where smartctl resides) is in your PATH.

Step 4: Perform Your First Disk Check

Now you can query disk information. Replace /dev/sdX with your disk's name (e.g., /dev/sda):

sudo smartctl -a /dev/sdX

Key points in the output:

  • SMART overall-health self-assessment test result: PASSED or FAILED. If FAILED — the disk will fail soon.
  • SMART capabilities: Should be Enabled. If Disabled, enable it with sudo smartctl -s on /dev/sdX.
  • Attributes (ATTRIBUTE_NAME): Pay attention to:
    • Reallocated_Sector_Ct (reallocated sectors) — a value >0 indicates wear.
    • Current_Pending_Sector (pending reallocation) — a value >0 is a warning sign.
    • UDMA_CRC_Error_Count (cable errors) — often indicates a bad SATA cable.
    • Temperature_Celsius — disk temperature.

Quick Health Check

If you only need the overall status, use:

sudo smartctl -H /dev/sdX

Output will be brief:

SMART Health Status: OK

Step 5: (Optional) Configure the smartd Background Daemon

For automatic regular monitoring, you can run the smartd daemon. It will check disks on a schedule and send notifications (e.g., to syslog).

  1. Edit the configuration:
    sudo nano /etc/smartd.conf
    
  2. Add a line for your disk (example for /dev/sda):
    DEVICESCAN -a -o on -S on -s (S/../.././02|L/../../6/03)
    
    Where:
    • DEVICESCAN — automatically find all SMART-capable disks.
    • -a — monitor all attributes.
    • -o on — enable automatic data collection at startup.
    • -S on — enable automatic attribute saving.
    • -s — test schedule: short test every 2 hours, long test every 6 months.
  3. Start and enable autostart:
    sudo systemctl enable --now smartd
    
  4. Check status:
    sudo systemctl status smartd
    

Now the daemon will run in the background. Check logs in /var/log/syslog or with journalctl -u smartd.

Verification

After completing the steps:

  1. Run sudo smartctl -a /dev/sdX and ensure the output shows no access errors and displays full information.
  2. If you configured smartd, verify the daemon is active: sudo systemctl is-active smartd (should return active).
  3. For a test, try running a short test manually:
    sudo smartctl -t short /dev/sdX
    
    Wait 1-2 minutes, then run sudo smartctl -a /dev/sdX again and look for the Self-test execution status section at the end with the result.

If all steps completed without errors — installation and basic configuration are done.

Potential Issues

1. Error SMART support is: Unavailable or Unable to detect SMART capability

  • Cause: The disk or controller is not passing SMART data (common with RAID arrays or some USB enclosures).
  • Solution:
    • For RAID: use utilities from the controller manufacturer (e.g., MegaCli for LSI).
    • For USB: try connecting the disk directly via SATA.
    • For NVMe: use sudo smartctl -a /dev/nvme0 (note the -d nvme option for some versions).

2. Error Permission denied or smartctl: Command line error: Invalid argument (-a)

  • Cause: Forgot sudo or specified an incorrect disk name.
  • Solution: Always use sudo and verify the disk name with lsblk.

3. smartd fails to start or cannot find disks

  • Cause: Incorrect configuration in /etc/smartd.conf.
  • Solution:
    • Simplify the config: DEVICESCAN -a (for testing only).
    • Verify disks are readable for SMART: does sudo smartctl -a /dev/sdX work?
    • Check logs: sudo journalctl -u smartd -n 50.

4. User lacks permissions to read SMART (without sudo)

  • Cause: By default, only root can read SMART data.
  • Solution: Add the user to the disk group:
    sudo usermod -aG disk $USER
    
    Note: This grants access to all disks. Log out and back in, or run newgrp disk.

5. smartctl reports SMART overall-health self-assessment test result: FAILED!

  • Cause: The disk already has critical attributes (e.g., many reallocated sectors).
  • Solution: Replace the disk immediately. Back up data as a priority. A SMART failure means the drive may fail at any moment.

6. For NVMe drives: smartctl: Permission denied or No such device

  • Cause: NVMe requires specifying a driver.
  • Solution: Use:
    sudo smartctl -a -d nvme /dev/nvme0
    
    Or for auto-detection:
    sudo smartctl -a /dev/nvme0
    
    (newer smartmontools versions auto-detect the driver).

F.A.Q.

How to check if my disk supports SMART?
Is it necessary to reboot the system after installing smartmontools?
How to set up automatic weekly disk checks?
Why does smartctl give a 'Permission denied' error?

Hints

Identify the disk name
Install the smartmontools package
Check the installed utility version
Perform a test disk check
FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community