Menu: runbooks, process, how-to, NIS2, wireless

How-to H7

Status
Published
Last reviewed
Written

Read disk health with smartctl

Read SMART and NVMe health data, compare it with earlier readings, and decide when a disk should be replaced.

Before you start

  • smartmontools installed on the host, and a root shell (or an elevated prompt on Windows, where smartmontools also runs).
  • Know your disk layout: which disks are behind a hardware RAID controller. Those need the controller’s device type option, for example -d megaraid,N for disk N on a MegaRAID controller (see the manual).
  • Your last reading for each disk, if you have one. A single reading tells you little; the change between readings tells you a lot.

Steps

1. List the disks smartctl can see

smartctl --scan

Source: smartctl(8), —scan

2. Identify each disk by serial number

smartctl -i /dev/sda

Source: smartctl(8), -i

Write down model and serial number. Device names like /dev/sda can change after a reboot or a disk swap; the serial number is what you tell the person pulling the disk.

3. Overall health

smartctl -H /dev/sda

Source: smartctl(8), -H

The manual: if the device reports a failing health status, “the device has already failed, or … is predicting its own failure within the next 24 hours”. Get the data off it now.

4. All the details

smartctl -x /dev/sda

Source: smartctl(8), -x

For an NVMe drive use the NVMe device, for example smartctl -x /dev/nvme0. Save the output with the date in the file name.

5. Run a short self-test and read its result

smartctl -t short /dev/sda
smartctl -l selftest /dev/sda

Source: smartctl(8), -t and -l selftest

The manual says a short test usually takes under ten minutes and can run during normal operation. Read the self-test log after that time.

What good and bad look like

AdminCycle’s rule of thumb below is not a vendor threshold. Vendors define their own.

  • Good: health status passes, the counts below are zero or unchanged since the last reading, and the latest self-test completed without error.
  • Watch it: any reallocated, pending or offline uncorrectable sector count that is above zero but has not changed for months. Read it again next month.
  • Replace it: any of those counts growing between readings, a self-test that ends with a read failure, or an NVMe drive whose critical warning is set, whose available spare falls towards its threshold, or whose media error count grows.
  • Replace it now: a failing health status (step 3).
  • Probably the cable, not the disk: a growing interface CRC error count on a SATA disk. Reseat or replace the cable, then watch it.

Traps

  • “PASSED” is not proof of health. Many disks fail with a passing overall status. Read the counts and compare.
  • A disk behind a RAID controller may show only the controller’s virtual disk. Use the -d option for your controller, or the controller’s own tool.
  • Pulling the wrong disk. Match the serial number on the label, not the slot you think it is in.
  • Long self-tests on a dying disk add load. If the counts are already growing, copy the data first.
  • A degraded RAID set with a second disk showing growing counts: replace the worst one first, and do not start a long rebuild without a current backup.

Undo

Reading is safe. A running self-test can be stopped:

smartctl -X /dev/sda

Source: smartctl(8), -X

Record it

Example included. The row marked Example is made up to show the format. Delete it and add your own rows.

Date Host, serial Health Reallocated Pending Self-test Change since last Action Initials
Example: 2026-12-06 HV01, serial ending 4F2A Passed 8 0 Completed without error Reallocated was 0 Order a replacement AB

Sources

Was this useful?

Esc
↑ ↓ moveEnter openEsc close