[Solved] How to manually recover Pihole configs

The issue I am facing:
I had an SBC that was hosting Pihole fail. The memory card is still good but I don't have any more of that type of SBC. So I can't just boot it in a new system to boot it up. If I put the memory card into the SD slot on my Linux laptop is there anyway to manually extract the different config files? Mostly, where are the files I should extract? The DHCP, and DNS setup are probably the biggest ones I would want to move to a new system.

Your best option would be to import a Teleporter backup.
Do you have a Teleporter backup created by that orphaned Pi-hole installation?

If not, then for the most part, just copying some files and dropping them in your new Pi-hole won't work.

Pi-hole v6 was released last week, and it has re-organised what files it uses and in which location those would be stored.

But setting up a new Pi-hole doesn't take long, and I'd assume that DNS configuration would be rather simple.

I guess your biggest concern would be your filtering rules, specifically individually blocked domains, and to reuse your old static DHCP lease definitions. Those would have been stored in /etc/pihole/gravity.db and /etc/dnsmasq.d/04-pihole-static-dhcp.conf.

For the latter, you could try to manually transfer those.
Navigate to Settings | DHCP and switch from Basic to Expert mode.

In the pane's lower half, you'll find a mutli-line entry box under Static DHCP configuration.
Pasting the contents of your old 04-pihole-static-dhcp.conf and hitting Save&Apply should bring them back into Pi-hole v6.

For trying to reuse gravity.db, you'd have to first stop your Pi-hole:

sudo systemctl stop pihole-FTL

You could then copy that old file to your new Pi-hole, overwriting /etc/pihole/gravity.db.

The restart Pi-hole:

sudo systemctl start pihole-FTL

Chances are that Pi-hole would be able to read and convert the old database into the new format at startup.

If that doesn't work, stop Pi-hole again an remove the database via sudo rm /etc/pihole/gravity.db.

Pi-hole would then create an empty gravity database upon restart.

1 Like

Thank you. That was the information I needed. I guess with the new version out this was just an unfortunate timing for this failure. I'll have to look into automating the teleport backups when I get it running again. I have an older teleport for about 6 months ago I'll try and see how old the configuration is.

Just noticed you've edited your topic's title - in this forum, you can tick a post as a solution. :wink:

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