> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Check Disk Health with smartctl on Linux

> Check disk health with smartctl: install smartmontools, run smartctl -H for the verdict and smartctl -a for attributes, run a self-test and set up smartd alerts.

To check disk health on Linux, install `smartmontools` and run `sudo smartctl -H /dev/sda`: `PASSED` means the drive does not predict its own failure. For the full picture, run `sudo smartctl -a /dev/sda` and look at reallocated and pending sectors (hard disks and SATA SSDs) or `Percentage Used` and `Media and Data Integrity Errors` (NVMe). Start a self-test with `sudo smartctl -t short /dev/sda`.

| Difficulty | Time | Works on | Needs |
| - | - | - | - |
| Intermediate | 10 minutes | Dedicated servers with physical disks, on any Linux distribution | sudo, `smartmontools` |

## Before you start

* This page is for **dedicated servers**, where Linux talks to real disks. A **VPS** uses virtual disks, which usually do not expose SMART data: `smartctl` then reports `Unable to detect device type`. That is expected and says nothing about the physical hardware. Keep VPS data safe with [panel backups](https://help.freakhosting.com/portals/vps-panel/how-to-schedule-and-restore-backups.md) and your own [backups](https://help.freakhosting.com/portals/other/how-to-back-up-a-linux-server.md).
* **SMART** (Self-Monitoring, Analysis and Reporting Technology) is the drive's own health log. A drive can fail without warning even when SMART looks fine, so it never replaces backups.
* Commands use `sudo`; root users can leave it out.

## How to install smartmontools

> [tab] Ubuntu / Debian
>
> ```bash theme={null}
> sudo apt update && sudo apt install smartmontools
> ```

> [tab] AlmaLinux / Rocky / Fedora
>
> ```bash theme={null}
> sudo dnf install smartmontools
> ```

## How to find your disks

```bash theme={null}
sudo smartctl --scan
```

```text theme={null}
/dev/sda -d scsi # /dev/sda, SCSI device
/dev/sdb -d scsi # /dev/sdb, SCSI device
/dev/nvme0 -d nvme # /dev/nvme0, NVMe device
```

`lsblk -o NAME,SIZE,MODEL,SERIAL` also lists each disk with its model and serial number.

## How to check disk health with smartctl

**1. Get the overall verdict**

```bash theme={null}
sudo smartctl -H /dev/sda
```

```text theme={null}
SMART overall-health self-assessment test result: PASSED
```

`FAILED` means the drive has failed or expects to fail soon. Back up straight away.

**2. Read the details**

```bash theme={null}
sudo smartctl -a /dev/sda
```

For SATA disks, `sudo smartctl -x /dev/sda` shows even more, including logs `-a` leaves out.

**3. Check the attributes that matter**

See the tables below. Rising numbers matter more than a single reading, so note today's values.

### Hard disks and SATA SSDs: what to look at

| ID | Attribute | What a non-zero value means |
| - | - | - |
| 5 | `Reallocated_Sector_Ct` | Bad sectors already replaced by spares. Watch for increases |
| 197 | `Current_Pending_Sector` | Sectors the drive could not read and may reallocate |
| 198 | `Offline_Uncorrectable` | Sectors that could not be read or fixed |
| 199 | `UDMA_CRC_Error_Count` | Errors on the cable or connection, not the disk surface |

Use the `RAW_VALUE` column. Any growth in 5, 197 or 198 is a reason to plan a replacement.

### NVMe drives: what to look at

```bash theme={null}
sudo smartctl -a /dev/nvme0
```

| Field | Healthy |
| - | - |
| `Critical Warning` | `0x00` |
| `Available Spare` | Above `Available Spare Threshold` |
| `Percentage Used` | Below 100%. This is the share of the drive's rated write endurance used |
| `Media and Data Integrity Errors` | `0` |

## How to run a SMART self-test

**1. Start the test**

```bash theme={null}
sudo smartctl -t short /dev/sda
```

A short test usually takes a few minutes; `smartctl` prints when it will finish. `-t long` is thorough and can take hours on large disks. The disk stays usable meanwhile.

**2. Read the result**

```bash theme={null}
sudo smartctl -l selftest /dev/sda
```

`Completed without error` is good. `Completed: read failure` means the disk has unreadable sectors.

## How to check disks behind a RAID controller

Disks behind a hardware RAID controller are hidden behind one logical device. Tell `smartctl` which physical disk to query, for example for a MegaRAID/PERC controller:

```bash theme={null}
sudo smartctl -a -d megaraid,0 /dev/sda
sudo smartctl -a -d megaraid,1 /dev/sda
```

`smartctl --scan` often lists the right `-d` value. With Linux software RAID (mdadm), query each member disk directly, as above.

## How to get alerts with smartd

The `smartd` service checks your disks in the background and emails you when something changes. It needs working mail on the server.

1. Edit the configuration file. On Ubuntu / Debian it is `/etc/smartd.conf`; on AlmaLinux / Rocky, `rpm -qc smartmontools` shows its path. Comment out the existing `DEVICESCAN` line with `#` and add:
   ```ini theme={null}
   DEVICESCAN -a -m you@example.com
   ```
2. Enable and restart the service:

> [tab] Ubuntu / Debian
>
> ```bash theme={null}
> sudo systemctl enable --now smartmontools
> sudo systemctl restart smartmontools
> ```
>
> On these systems `smartd` is an alias of the `smartmontools` service, so `systemctl restart smartd` also works, but enabling must use the real name.

> [tab] AlmaLinux / Rocky / Fedora
>
> ```bash theme={null}
> sudo systemctl enable --now smartd
> sudo systemctl restart smartd
> ```

## What to do if a disk is failing

1. Make a fresh backup immediately. See [back up a Linux server](https://help.freakhosting.com/portals/other/how-to-back-up-a-linux-server.md).
2. Note the disk's serial number: `sudo smartctl -i /dev/sda`.
3. If the disk is part of software RAID, follow [replace a disk with mdadm](https://help.freakhosting.com/portals/other/how-to-check-and-manage-software-raid-with-mdadm.md).
4. [Open a ticket](https://freakhosting.com/clientarea/submitticket.php) with the `smartctl -a` output and serial number.

## Frequently asked questions

### Why does smartctl say "Unable to detect device type" on my VPS?

VPS disks are virtual devices, which usually do not pass SMART data through. This is normal and you cannot check physical disk health from inside a VPS.

### Does PASSED mean my disk is fine?

It means the drive does not predict failure by its own thresholds. Disks can still fail suddenly, and attributes such as pending sectors can rise long before the verdict changes. Read the attributes and keep backups.

### How often should I check SMART?

Let `smartd` check continuously and email you. Look at the full `smartctl -a` output monthly, or after any disk errors in `journalctl -k`.

### Is a short self-test safe on a live server?

Yes. Self-tests run inside the drive while it keeps working. A long test may slow heavy disk work slightly.

## Related guides

> [card] [VPS and dedicated server guides](https://help.freakhosting.com/portals/other/vps-and-dedicated-server-guides.md)
>
> Every guide in this section.

> [card] [Software RAID with mdadm](https://help.freakhosting.com/portals/other/how-to-check-and-manage-software-raid-with-mdadm.md)
>
> Check arrays and replace a disk.

> [card] [Back up a Linux server](https://help.freakhosting.com/portals/other/how-to-back-up-a-linux-server.md)
>
> Protect your data first.

> [card] [Check disk I/O performance](https://help.freakhosting.com/portals/other/how-to-check-disk-io-performance-on-linux.md)
>
> Find slow disks.

> [card] [Read logs with journalctl](https://help.freakhosting.com/portals/other/how-to-read-logs-with-journalctl.md)
>
> Look for kernel disk errors.

***

> [!NOTE]
>
> **Checked against the official [smartctl manual page](https://man.archlinux.org/man/smartctl.8.en) from smartmontools** on 4 November 2026; installation, the default `smartd.conf`, the service names and the `Unable to detect device type` result on a virtual disk checked on Ubuntu 24.04 LTS (smartmontools 7.4). Health output examples could not be produced on physical disks in our environment. Commands can differ on other distributions or releases.

> [!NOTE]
>
> ### Need Extra Help?
>
> If you encounter any issues, our support team is ready to assist:
>
> * **Live Chat:** Quick assistance via our website.
> * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
> * **Discord:** [Join our Community](https://discord.gg/freakhosting)
> * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)

> [!TIP]
>
> ### Save on Your Hosting
>
> Ready to upgrade your hosting? Use code **KB20** at checkout for **20% off** your first order!

***

**Last Updated:** November 2026


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.