← How-Tos
raspberry-pi 4 days ago ◑ 14 views ◯ 5 min read

Monitoring Raspberry Pi SD Card and NVMe SSD Health: SMART Data, Wear Leveling, and Predicting Failure

raspberry pisd cardnvmesmart datastorage healthwear levelingpi 5

A Raspberry Pi running a print farm dashboard, Home Assistant instance, or self-hosted media server is only as reliable as its storage, and storage media gives plenty of warning before it dies — if you know where to look. Most Pi owners find out their SD card or NVMe SSD is failing the hard way: a corrupted filesystem, a service that silently stopped logging weeks ago, or a boot that just never comes back. This covers how to actually monitor storage health on a Pi before that happens, for both SD cards and the NVMe SSDs increasingly used on Pi 5 boards.

Why Pi Storage Fails Differently Than a Laptop's

SD cards and cheap USB flash storage use NAND flash without the sophisticated wear-leveling, over-provisioning, and health-reporting firmware found in a proper SSD controller. Every Pi project that writes logs, databases, or frequent small files (Home Assistant's recorder database, Octoprint's history, a Pi-hole query log) is hammering a storage medium that was often designed for occasional photo/video writes, not constant small-write workloads. NVMe SSDs on a Pi 5 are a different story — real SSD controllers with wear-leveling and SMART reporting — but they still benefit from active monitoring, especially budget drives with less robust controllers.

Monitoring an NVMe SSD with SMART

If you've migrated to NVMe boot on a Pi 5 (via a PCIe HAT or the native M.2 HAT+ options), you have access to real SMART (Self-Monitoring, Analysis, and Reporting Technology) data, the same health telemetry a desktop or server SSD exposes.

  1. Install the NVMe command-line tools: sudo apt install nvme-cli
  2. Identify your drive: sudo nvme list
  3. Pull the health log: sudo nvme smart-log /dev/nvme0n1

The fields that actually matter for predicting failure:

FieldWhat it meansWatch for
percentage_usedManufacturer's estimate of drive endurance consumed, 0-100+ (yes, it can exceed 100 on a drive run well past its rated life)Climbing steadily toward 100% on a drive that matters; plan replacement well before it gets there
media_errorsCount of uncorrectable media errors the controller has hitAny non-zero value, and especially any value that's increasing between checks
critical_warningBitmask flag for serious conditions (temperature, available spare below threshold, read-only mode)Any non-zero value — investigate immediately
available_spareRemaining spare NAND blocks as a percentageDropping below the available_spare_threshold field's value
temperatureDrive temperatureSustained high temps in a poorly ventilated Pi case/HAT stack — NVMe SSDs throttle or degrade faster when chronically hot

Monitoring an SD Card (Which Has No Real SMART)

This is the part most guides skip, because the honest answer is: consumer SD cards generally don't expose meaningful SMART data the way SSDs do, even though some do respond to standard SMART commands with placeholder or non-standard values that aren't actually useful. Rather than relying on health reporting that doesn't really exist for SD media, the practical approach is a layered defense:

Setting Up Automated Monitoring

A simple cron-driven script that logs the relevant health data on a schedule, and alerts you when something crosses a threshold, turns this from "check manually and hope you remember" into actual monitoring:

#!/bin/bash
# /usr/local/bin/storage-health-check.sh
LOGFILE="/var/log/storage-health.log"
echo "=== $(date) ===" >> "$LOGFILE"

if command -v nvme >/dev/null && [ -e /dev/nvme0n1 ]; then
    sudo nvme smart-log /dev/nvme0n1 >> "$LOGFILE"
fi

dmesg | grep -i -E "mmc|i/o error|blk_update_request" | tail -20 >> "$LOGFILE"

Schedule it weekly with crontab -e (e.g., 0 3 * * 0 /usr/local/bin/storage-health-check.sh), and for anything more than passive logging, pipe alerts that match error patterns to a notification service, or feed the results into whichever monitoring stack already watches the rest of your shop network (Uptime Kuma, Grafana, or similar covered elsewhere on this site) rather than building a second standalone alerting system.

What to Actually Do With a Failing Drive

  1. Back up immediately the moment you see rising error counts, climbing percentage_used, or recurring I/O errors — don't wait for a "clean" moment, since storage that's actively throwing errors can fail completely without further warning.
  2. Clone rather than reinstall if the drive is still readable: tools like rpi-clone or a straightforward dd image-and-restore let you move a working Pi OS install to new media without rebuilding every service from scratch.
  3. Replace proactively on anything running unattended — a Pi controlling a print farm, security cameras, or home automation is exactly the kind of device where "it'll probably be fine a while longer" costs you more in downtime than a $15-30 replacement card or drive.

SD cards will never give you the rich SMART telemetry a real SSD does, and that's exactly why the habit of reducing unnecessary writes, watching the kernel log for early I/O errors, and backing up proactively matters more on a Pi than it does on a machine with enterprise-grade storage. For NVMe-equipped Pi 5 builds, you get genuine SMART data for free — the only mistake is not checking it until something's already gone wrong.