Intro
I have a vast army of Raspberry Pis serving me (although recently I've been liking ESP32 for some of the simpler tasks I've used to use Pis for, and mini PCs for the more complex ones). I just had my first SD card failure in one. This was a bit more annoying than I predicted it would be, so I set out to come up with a good automated backup process for my Pis. As with everything I do, there are plenty of good write ups about how to do this online, and you will undoubtedly find those more useful if you actually want to do this, but I will document what I did here for 1. hypothetical fellow weirdos, 2. myself from the future.
NFS Server
I have a home server, with all my bulk storage in it. I primarily run Plex and Home Assistant on it, but I also host my music collection on it, which I share out to my desktop and other clients via NFS. NFS is just the Linux version of network shared drives. I won't go into details about how to set up NFS, but this is a good overview.
Backup Script
Once you have a NFS server set up, you can just mount a drive there on your Pi with write access. I then use rsync to send directories to the network drive nightly. Here's my script along with some notes.
I chose the directories with configuration and data that I cared about in them, although it should cover most uses.