Drive failure.

My media server’s external drives dropped offline twice in three weeks. This is the postmortem: what happened, how I found the real cause, and what I built so I’d hear about the next failure within 15 minutes.

What happened

The first time, on Oct. 1, 2026, it was heat. The dock had no fan, and one drive reached 45°C before it dropped.

The second time, on Oct. 22, both drives dropped at a normal 37°C. Heat didn’t explain that one.

How I found the cause

The drives’ own health data (SMART) showed one drive had logged nearly 9,000 interface errors, known as CRC errors. The other had none.

That pointed to a bad connection between that one drive and the dock’s shared USB bridge. Whenever the link glitched, the bridge reset and took both drives down with it. The drives themselves were healthy.

Recovery

I detached the stale mounts and ran filesystem checks on both drives. No data was lost. Then I remounted them by their permanent filesystem IDs, so a shuffle in device names can never break them again.

What I changed

  • A cooled enclosure. I replaced the fanless dock with a fan-cooled three-bay enclosure.
  • Mounts that fail gracefully. A missing drive can no longer stop the server from booting.
  • A watch on the drive link. An hourly check alerts me if the link error count starts rising again.
  • Health checks on both servers. Every 15 minutes they check that the drives are mounted and readable, backups are fresh, my business app and its public links are up, and disk space, drive health and CPU temperature are where they should be. Each problem sends one alert when it breaks and one when it recovers, with nothing in between.
  • Safer backups. I added a second backup drive, and every backup job now skips its run when a drive is missing instead of quietly writing to the wrong disk.

Result

Two weeks later, the error count hasn’t moved. If something fails now, I’ll hear about it within 15 minutes instead of finding it by accident.

Three weeks of readings

8TB drive temperature, hourly, Oct. 2 to 22, 2026Hourly readings from the 8TB drive in Eastern time. It stayed between 34°C and 44°C, below the old 50°C warning level the whole time, so no alerts were sent. The new levels, warn at 42°C and clear at 40°C, are drawn on the chart.30°35°40°45°Oct. 6Oct. 10Oct. 14Oct. 18Oct. 22Warn at 42°C (new)Clear at 40°C (new)Peak 44°C, Oct. 2
Hourly readings from the 8TB drive, Oct. 2 to 22, 2026, in Eastern time. The log starts the day after the drive dropped off. It peaked at 44°C. That was under the old 50°C warning level, so no alerts were sent. The lines show the new levels: warn at 42°C, clear at 40°C.

The hourly logger

Run from cron every hour. It finds each drive by where it’s mounted, reads its temperature and adds a line to the log.

#!/bin/bash
# Mount points and the log location live in a private config file.
source "$PRIVATE_CONFIG"
disk_for() { findmnt -no SOURCE "$1" | sed 's/[0-9]*$//'; }
temp() { [ -n "$1" ] && smartctl -a "$1" -d sat | awk '/Temperature_Celsius/{print $10}'; }
echo "$(date '+%Y-%m-%d %H:%M')  8TB: $(temp $(disk_for "$DRIVE_8TB"))C  2TB: $(temp $(disk_for "$DRIVE_2TB"))C" >> "$TEMP_LOG"

The alert check

Also hourly. It sends one Telegram message when a drive passes 42°C, one when both drives are back under 40°C, and its own alert if a drive stops reporting a temperature at all. A small state file remembers which alerts have gone out, so each one is sent only once.

#!/bin/bash
# Bot credentials, mount points and the state file live in a private config.
source "$PRIVATE_CONFIG"

STATE="$ALERT_STATE"
WARN=42
CLEAR=40

# Resolve a mount point to its parent block device.
# findmnt gives the partition; stripping its trailing digits
# gives the whole disk, which is what smartctl wants.
# This survives the kernel reordering drive letters across reboots.
disk_for() { findmnt -no SOURCE "$1" | sed 's/[0-9]*$//'; }

D8=$(disk_for "$DRIVE_8TB")
D2=$(disk_for "$DRIVE_2TB")

temp() { [ -n "$1" ] && smartctl -a "$1" -d sat | awk '/Temperature_Celsius/{print $10}'; }

T8=$(temp "$D8")
T2=$(temp "$D2")

send() {
  curl -s -X POST "https://api.telegram.org/bot${TG_TOKEN}/sendMessage" \
    -d chat_id="${TG_CHAT}" -d text="$1" > /dev/null
}

prev=$(cat "$STATE" 2>/dev/null || echo ok)

# No temperature means the drive fell off the bus or the mount vanished —
# which is exactly the Oct 1 failure, so it gets its own alert.
if [ -z "$T8" ] || [ -z "$T2" ]; then
  [ "$prev" != "error" ] && send "⚠️ Server: can't read a drive temperature — a drive may have dropped off the bus" && echo error > "$STATE"
  exit 0
fi

if [ "$T8" -ge "$WARN" ] || [ "$T2" -ge "$WARN" ]; then
  [ "$prev" != "hot" ] && send "🔥 Server drives hot — 8TB: ${T8}C  2TB: ${T2}C" && echo hot > "$STATE"
elif [ "$T8" -lt "$CLEAR" ] && [ "$T2" -lt "$CLEAR" ]; then
  [ "$prev" != "ok" ] && send "✅ Server drives normal — 8TB: ${T8}C  2TB: ${T2}C" && echo ok > "$STATE"
fi
exit 0

Next

An off-site copy of my business data, and a battery backup (UPS) so a power cut can’t take the servers down in the middle of a write.

Questions about the monitoring?

I’m happy to talk through how it works.

Get a quote