Keep a Pi usable when the microSD card starts to fail
Intermittent boots, remounted filesystems, and services that vanish after a power blip are often storage problems before they are software problems. Capture `dmesg` output and SMART-like counters from USB SSDs when available. Note whether failures cluster after heavy writes such as camera archives, databases, or container pulls.
Separate OS and data early
Put mutable data on a USB SSD or network volume while the microSD holds only the boot and root filesystem. This does not remove the need for backups, but it reduces how often a worn card takes the whole stack with it. Label cables and ports so you can reseat the storage without guessing.
Build a known-good image
Once the machine is healthy, image the boot media to another card or file and verify the checksum. Store that image somewhere that does not live on the Pi. Practice flashing the spare card and bringing SSH back with the same hostname and key. A spare that has never been powered on is only a hope until you boot it once.
Decide when to replace instead of repair
If filesystem checks keep finding new errors, schedule a cutover instead of another night of fsck. Move data first, then recreate services from your notes. Keep the failing card labeled with the date and symptom so you do not reuse it as a “temporary” disk later.