I have a load-bearing raspberry pi on my network - it runs a DNS server, zigbee2mqtt, unifi controller, and a restic rest server. This raspberry pi, as is tradition, boots from a microSD card. As we all know, microSD cards suck a little bit and die pretty often; I’ve personally had this happen not all that long ago.
I’d like to keep a reasonably up-to-date hot spare ready, so when it does give up the ghost I can just swap them out and move on with my life. I can think of a few ways to accomplish this, but I’m not really sure what’s the best:
- The simplest is probably cron + dd, but I’m worried about filesystem corruption from imaging a running system and could this also wear out the spare card?
- recreate partition structure, create an fstab with new UUIDs, rsync everything else. Backups are incremental and we won’t get filesystem corruption, but we still aren’t taking a point-in-time backup which means data files could be inconsistent with each other. (honestly unlikely with the services I’m running.)
- Migrate to BTRFS or ZFS, send/receive snapshots. This would be annoying to set up because I’d need to switch the rpi’s filesystem, but once done I think this might be the best option? We get incremental updates, point-in-time backups, and even rollback on the original card if I want it.
I’m thinking out loud a little bit here, but do y’all have any thoughts? I think I’m leaning towards ZFS or BTRFS.
I can’t remember the steps (they were simple though) but when my Home Assistant raspi SD card died, I bought a 128gb SSD from AliExpress and a usb-sata cable.
I then did something to the pi that meant it can boot from the SSD, and flashed the SSD using Balenetcher or RUFUS or whatever (same program I was using to flash my SD cards basically).
Then it was just a case of plugging in and turning it on.
Runs exactly the same as with an SD card with less dying because SD cards aren’t meant for a lot of read/write but SSDs do.
That’s true, just booting from an SSD would be a lot more reliable and simple.
Just Google “Booting a pi from an SSD” and follow the steps