Killed my OS, is there a way to save the Pihole data ?

Help,
I somehow totallly f*cked up my Raspberry Pi 4 OS during updating, i now have to do a fresh install.
I have tried anything, the only thing remaining is manually accessing the sd card from my pc.

The question i have is:
Is there a way to save the Pihole Blocklists, configuration and even more important the Whitelist from the sd card ?

Idk, something like copy pasting a file from it to the new install ?

NOT TESTED:

If you were running Pi-hole v6, you can try (this is not guarantee to work) to copy all files from /etc/pihole/. Then install Pi-hole on the new card and copy the original files back to /etc/pihole/.

This (probably) won't work if you were running Pi-hole v5, because the fresh install will create v6 files and the backup will contain v5 files.

There is no "etc" folder on the SD Card, there are lots of .dbt .dat .elf files and a folder named "overlays" full of .dtbo files.

Are you trying to access your sd card from a Windows machine?
That would show you only the boot partition.

You'd need to access the Linux partition, preferably from a Linux system.
If you only run Windows, you may be able to access your sc card via WSL, or you may have to install compatible drivers (but that may require you to know the partition as well as filesystem types).

Personally, I found that trying to go the Windows/WSL route to be a pain mostly with USB drives, or MicroSD loaded into a USB adapter, and gave up trying to find a Windows driver that would support a fairly standard Linux file system, like ext4. Spent a good bit of time, kept running into walls, and finally gave up with Windows accessing a Linux partition. Seem to recall I had this working once, and then it would not work.

I created a separate MicroSD for my RPi that can I can easily mount a separate Linux based MicroSD in a USB adapter. Works well, and fewer headaches.

Even if I could somehow get Windows to cooperate, I am not convinced some OS change won’t make a hash of it again.

I am Using Windows and don't have a Linux system.

But even if there were a Partition that only linux could read, shouldnt that show on the Windows Partition manager as well ?

In the Partition manager it only shows Boot and the rest as Free space, nothing else.

Get your Raspberry pi 4 running using another SD card, then insert the previous SD card into a USB adaptor, plug into the Pi, and access from the Raspberry Pi.

Another alternative is to download and boot a live Linux distribution. I always keep the latest Manjaro ISO on my Ventoy key.

A potentially lighter weight option would be to download and boot something like SystemRescueCD.

Neither will touch your installed Windows system.

It worked, i made a new install and then copy pasted the old data from /etc/pihole to the new /etc/pihole/, all lists are back.

Thank you

For one of my own sd cards, Linux may show:

Windows' disk partition utility won't show you any information for partition types it does not know, apart from acknowledging there is a partition, e.g. for that same sd card:

If Windows would really show the space as free, I'd keep my fingers crossed for you that your partition wasn't deleted or compromised (which apparently didn't happen in your case, as you've succeeded in restoring your system. :wink: )