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.

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

I have a couple of cron jobs one on the pi running pi-hole to complete the backup. And a second that pulls the backups off the pi-hole with ssh keys. Run a daily backup using pihole -a -t to a location (/backup/).

find /backup/_old -name "*.gz" -type f -mtime +90 -delete #change 90 to number of days eq 30 = 30 days

I moved my pi-hole to boot from SSD so I push to the SD card for boot only and pull from a remote box for long term. Have built a number of scripts to pull backups from pfSense, unifi-protect, unifi, and HA. It been fun moving all these from SD cards to SSDs to allow for faster processing and with SSD 250~ Gb drives going for about $25. Worth not waiting for a corrupt SD. Had the same corruption issue.