Cloning Pi-hole setup and db's?

I need to replace my SD card in my PI.
I'd like to preserve the entire setup as identical PI-hole setup as possible including DB's, rules, DNS/DHCP config and so on.

OS setup/config is done (network config prepared), but I'm quite unsure what I need to manually copy over from old card after installing "clean" Pi-hole?
Should I stop some services to avoid overwriting?
Any permissions to set/re-set?

All help appreciated!

Use the Pi-hole teleporter function to export and import your Pi-hole settings.

Hmmm...
Tried Teleporter (on 5.1) but as far as I could see it didn't import everything:

On another RasPi with empty/non-configured Pi-hole;
All I did was to test was 'Teleporter' -> 'Backup'
'Teleporter' -> 'Choose file' -> 'Restore'

But following items wasn't restored:

  • Static DHCP leases configuration
  • Local DNS Records
  • Long term data
  • DHCP Range
  • Pi-hole domain name

What did I do wrong here?

https://github.com/pi-hole/AdminLTE/issues/1537

Since you really just want to move your existing configuration for an identical Pi-hole version to a new sd card, you could try copying configuration files manually.
However, this will use considerably more space, since it will include e.g. the whole gravity domain list instead of just the adlist names.

Most of user-specific configuration is found in /etc/pihole/ and /etc/dnsmasq.d/.
Try zipping or just copying these directories to a shared drive. Consider stopping the Pi-hole service before you copy (see below).

Start from your new Pi-hole sd card and disable the Pi-hole service by running

sudo service pihole-FTL stop

Copy and/or unzip folders to the respective locations on your new Pi-hole.
After starting the Pi-hole service again, Pi-hole should run with your old configuration.

If size is an issue, you could skip /etc/pihole/pihole-FTL.db - if you can live without your Long-term Query Log, that is. (I once had to copy the files to Raspbian's FAT boot partiton where space is limited, in order to do this in a pure Windows network).

And of course, if you manually altered or extended Pi-hole related configuration files in other locations like cron jobs or lighttpd, you'd have to include those respective files as well.

1 Like

Thanks!
Your instructions worked out great:
Installed "clean" Pi-hole
Stopped Pi-hole "sudo service pihole-FTL stop"
Copied entire contents of "/etc/pihole/" and "/etc/dnsmasq.d/" from old SD card to new one (via external storage).
Reboot
Done! :smiley:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.