Is it safe to backup the entire /etc/pihole directory and restore it on a fresh Pi install?

The issue I am facing:

My Pi won't power up at all due to a seemingly-faulty USB flash drive that it usually boots from. I therefore want to completely reinstall Debian on the USB, but would like to backup my Pi-hole configuration first.

So can I simply mount the USB's partitions on a separate PC (already done) and backup the entire /etc/pihole directory, then reinstall Debian and Pi-hole and restore the backup? MTIA! :smiley:

Details about my system:

I have a Raspberry Pi 4B 2 GB running Debian Trixie. I mainly use it for Pi-hole (which is also my LAN's DHCP and recursive DNS server using unbound) and as a media server, using samba and gerbera to serve my media files to all other machines on my LAN. Then SFTP is also used to access those files publicly across the Internet.

This recent article discusses this a lttle. I've not done this but it seems the answer is yes.

I never tried that, but recently another user tried the same thing with success.

Read the topic:

1 Like

Sorry should've mentioned that I'd already found that thread, which is what led me to start this one lol. I just wanted to confirm that the whole directory can be copied over and the existing files replaced after reinstallation of Pi-hole.

But judging by the other thread mentioned by @rdwebdesign , it should be even easier than that! Apparently I can copy the folder across after reinstallation of the OS but before reinstallation of Pi-hole, and everything will be upgraded as necessary. I'm yet to try this myself but it sounds really promising!

Wish me luck guys, and thanks for the responses :smiley:

1 Like

I'd love to hear how it goes for you and what exactly you copy from your old OS. Just a few days ago my Pi4 stopped working. I thought it was a bad SD card since it wasn't readable or writable, but a new SD card also fails so I think the whole Pi had some sort of electrostatic issue or something. Anyway I have a complete backup of the installed DietPi (Debian) OS on my NAS. When the new Pi4 comes in, it sounds like I can install DietPi, copy pihole from the backup, then install pihole to ensure everything is in place. That's what I'm going to try in any event since I don't think I can use teleporter to copy from a previous data folder.

1 Like

Sorry wish I could help you but I ended up trying to boot my Pi one last time before wiping the USB flash drive, and suddenly it worked!

So if you've only tried once or twice to boot yours, I'd suggest leaving it completely unplugged overnight like I did and trying it again the following morning.

Good luck! :blush:

Thanks, I discovered actual physical damage on my SD card reader when I opened up the case. I don't know if I shoved the card in at an angle or what, but I bent some pins under the cover, and that repair is beyond my ability.

I was able to boot from the USB adapter and copy the /etc/pihole from my recent backup, but unfortunately the libc-bin library won't configure properly with a USB adapter for some reason. I'm going to give up on this pi and wait for the new board that's hopefully arriving today.

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