Cron Backup to remote file system

Would be great to be able to mount a remote file system and run a cron based backup of PiHole. I'm running mine on a PiZero and a few times lost everything to a corrupt SD card on reboot. Be useful to have a regular backup schedule.

You might check out this simple project/script: GitHub - lzkelley/bkup_rpimage: Script to backup a Raspberry Pi disk image. I have been using for a couple of years now.

I know how to back up the SD image, but there is a manual backup routine in pinhole to backup various settings and config lists. Would be good to automate this.

Can you not just make a cron to run the appropriate Pi-hole command at the interval you desire?

It would be nice to have a sync feature built in (I don't see one in my interface) and that could be to a local / remote folder or another pihole? I only have 1, but if I had 2 I think that it would be really annoying.

#!/bin/bash
rm ~/pihole.tar ~/pihole.tar.xz ~/statping.tar ~/statping.tar.xz

rsync -a ~/pihole/* ~/pihole-bak/
rsync -a ~/statping/* ~/statping-bak/

tar -cf ~/pihole.tar ~/pihole-bak
tar -cf ~/statping.tar ~/statping-bak

xz -k4v ~/pihole.tar ~/statping.tar

scp ~/pihole.tar.xz ~/statping.tar.xz RemoteServer:vm-backup/SomeHostname/

This is one of the reasons why i choose Docker specifically for pihole and few other tools. These few lines above do the trick. Cron sends daily, so worse case scenario i have 23h of data loss.

Pihole has host folders mounted using bind:
-v /home/bercik/pihole/dnsmasq.d:/etc/dnsmasq.d -v /home/bercik/pihole/pihole:/etc/pihole