On 31/08/2021 13:35, Chris Green wrote: > I run dnsmasq on a Raspberry Pi to provide DHCP and DNS services on my > home LAN. It's just very handy having names for all devices rather > than having to use IP addresses. > > A few weeks ago the Pi died (or, more accurately, the SD card it was > running on died) and it took me quite a while to get things back > together again (like half a day or so, mostly down to trying to rush > things). This isn't "mission critical", nothing awful happened when > we didn't have the Pi providing DNS for half a day but it was 'messy'. > > So, I've been wondering how I can help myself sort things out more > easily and quickly if it happens again. What do others do? > > The ways I can think of are:- > > Have an 'image' SD card of the Pi kept up to date somehow so that > I can either change the SD card in the running Pi or use another > Pi in place of it. Problem is how to keep the image up to date. > > Have a 'warm backup' dnsmasq running on another system. There is > another Pi on the LAN and also a desktop server both of which are > on all the time. How easy is it to replace one dnsmasq system > with another on the LAN? > > Any other obvious ways? > > > Thanks for any ideas. >
A general suggestion would be: - I build my router images with a read only partition with the OS on, then I mount a writeable image over the top to capture "changes". (I use aufs, but modern options include unionfs) - Then I have another machine in my network running the (rather old) rsnapback2 software which is just an implementation of the well worn rsync backup tool with a dir for each snapshot, rotating hourly/daily/weekly, etc. (I might pick Borg if I were starting again today) - If I blow up a box (which I concede I did only a few days ago by ssh-ing into the wrong box and running some commands I didn't want to run), then I just re-install the read only bit (if needed) and restore the writeable partition on top I think you could implement just bits of this by choosing a slightly different structure for your /etc/, eg you can break up the dnsmasq file by just having the main file include pieces from some other locations. Careful choice would make it easier to just backup the changing parts of /etc A modern variation on the first idea is something like docker + mounting your own config files. Essentially this is equiv to building your read only image and then layering on that config files on top. I concede I don't use docker, but it's essentially further granularising the base operating system install. For my own home use this is about all I need. Probably for SD cards I would just rsync backup the card to a second stick periodically to make failure a case of just swapping the other in (something like "rsync -avXH --one-file-system" should do it, even while it's running?). For my use case monthly backups would be enough... How stale you could go will depend on your personal situation of course! If you wanted to go nuts, then my personal fav would be LXD in cluster configuration with some cluster filesystem (I concede I'm eyeballing seaweedfs rather than ceph...). You will need 3x raspberry Pi (not going to break the bank) and you can lose any one of them whilst still staying active (needs a quorum). You likely want to start hanging on the various reddit groups as they have all kinds of levels of extreme enthusiasm in this stuff... Have fun going down the rabbit hole! Ed W _______________________________________________ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss