deniz.in

Markets

Weather

Loading weather

· via dev.to (home feed)

Homelab k3s etcd moved from Raspberry Pi boot SD card to USB SSD before flash wear strikes

A dev.to post walks through a preventive migration of etcd data off a Raspberry Pi boot SD card to a USB SSD in a four-node k3s homelab, before consumer flash wear could take the cluster state down.

Homelab k3s etcd moved from Raspberry Pi boot SD card to USB SSD before flash wear strikes

What happened

A homelab operator has relocated the datastore that holds all state for a small Kubernetes cluster off a Raspberry Pi's boot SD card and onto a USB SSD — before anything actually broke. According to a post on dev.to by mrtoadie, the setup is a four-node k3s cluster built from Raspberry Pis, with one machine (nicknamed winterfell) acting as the control-plane node. That node runs the Kubernetes API server and, more critically, etcd, where deployments, secrets, config maps and node registrations all live. Until the migration, all of that sat on the same SD card the Pi booted from.

The notable part is what didn't happen: no outage, no corruption, no lost quorum, no late-night incident. The move was purely preventive, prompted by an uncomfortable realisation while looking over Prometheus dashboards — a metrics pipeline was quietly generating a steady stream of writes to a card never built for that.

Why an SD card is the wrong home for etcd

The post frames the problem as a clash of workloads. Consumer SD cards are engineered for read-heavy use: booting an OS, serving files, occasional updates. etcd is the opposite: continuous small writes, write-ahead log files, frequent fsync calls and constant compaction. Prometheus scraping metrics every few seconds added to the pile.

Sustained write traffic is exactly the pattern that wears out consumer flash, and the author points out that the failure mode is not selective. When a worn card gives out, it can take the entire filesystem down with it — along with the sole copy of the cluster's state, since quorum lived on that one disk.

There was also an argument from uncertainty. The author had no measurements of how many megabytes per hour were hitting the card, and treated that gap as the justification itself: if you can't estimate how hard a component is hammering your storage medium, the reasonable response is to plan for the worst.

How the migration worked

The plan carried one hard constraint. With a single control-plane node, stopping k3s on that machine takes the API server, quorum and scheduling offline for the whole cluster, so the author consciously accepted a period of full downtime for the homelab.

The procedure, as described:

  1. Stop k3s on the node before anything else. Copying etcd while it runs can leave you with a corrupted copy, so halting all writers came first.
  2. Copy the whole data directory, /var/lib/rancher/k3s, from the SD card to the SSD using rsync in archive mode, preserving ownership, permissions and timestamps.
  3. Format the SSD as XFS and mount it at the original path via /etc/fstab. Because the mount point matches the old location, k3s needed no configuration change — it finds its data exactly where it always looked.
  4. Verify before deleting anything: restart the cluster, confirm every node rejoined, check etcd quorum and workload scheduling, and only then erase the old copy from the SD card.

The filesystem choice comes with a rationale too. XFS is a journaling filesystem that copes well with many small writes and large directories — the profile etcd produces — and while ext4 would also work, the author says XFS is widely used on nodes that host etcd.

What it changed

After the move, the two disks have distinct jobs: the SD card's role is essentially just booting the OS, while the SSD carries the data. The author reports an unplanned benefit in operability — reimaging a node now means pulling and reflashing the SD card without ever touching cluster state. Performance, by contrast, did not measurably improve; the author declines to claim numbers without before-and-after benchmarks. A follow-up post on Prometheus memory usage is promised.

Why it matters

Running k3s on Raspberry Pis with everything on the boot SD card is one of the most common homelab patterns, and this post is a clear warning that a cluster's most critical data often sits on its least reliable medium — one that fails silently and suddenly. It is also a compact playbook: stop writers before copying, mount the replacement disk at the original path to avoid reconfiguration, and keep the old copy until the new location has survived a complete restart. Just as useful is the decision-making model on display: the absence of measurements was treated as a reason to act, not an excuse to wait.

  • #kubernetes
  • #k3s
  • #raspberry-pi
  • #homelab
  • #etcd
  • #storage

Related posts