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?
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.
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!