Lifespan of using pihole with a microSD card

my microSD card died after 3/4 year of use. are there any tipps to expand the lifespan of a microSD card or any alterntive solutions? and how often do you switch your card

1 Like

The biggest killer of cards is power supply. Get a decent power supply and heavy USB cable that is rated at the higher levels of power. Most wall adapters used are from phone chargers and the same type of thin cable that is improperly terminated. You may be able to boot up the device with lower quality cables and supplies, but you end up with voltage drops that will take out an SDCard. Sustained writes and reads really don't do much damage to cards now, on the older firmwares from years ago they had some issues but that's been almost completely eliminated. There are also a few Rasbperry Pi specific commands from the lower level access that will query the Pi to see if it's been throttled due to either overheat or low voltage that can tell if you're seeing these kinds of situations.

vcgencmd get_throttled <-- will give you info on conditions that may have caused throttling.

2 Likes

My /etc/fstab contains noatime and commit=300

PARTUUID=xxxxxxxx-xx / ext4 defaults,noatime,commit=300 0 1

Note that commit=300 can be quite dangerous on devices which are (often enough) not properly shut down. See e.g.

Yes, I know. But I don't like the default of 5 seconds (especially on SD cards).

I feel that this is the time to - again - point out that I still use the very first SD card in my Raspberry Pi B+ since about five years without any specific settings tweaking. You should be able to find multiple quite long articles of me through the search function of this forum as this question keeps coming up every now and then.

i will definitely check this but i doubt my power supply killed my microSD card.

what about disabling the logs? i think that read from the log and write to the log killed my microSD card. Havent used anything else on my raspberry pi zero. i had like ~8000 requests per day.

If it was a case of the number of writes then we'd see a lot more of this issue come up. We roughly estimate that around 70% of the Pi-hole installs are on Single Board Computers.

And noatime may get you a little bit on the log partition if it indeed is the power supply and brownouts/voltage unders then the long cache time will cause file corrpution.

1 Like

Use log2ram

Usefull for Raspberry for not writing all the time on the SD card.

Note: if you log to ram on the Pi's with limited memory you can end up causing more problems. Just depends on what you are putting in to RAM and how much you have allocated.

That correct

I have define 40 Mb for /var/log
At this moment all logfiles use 7.3 Mb

I don't think having to replace a relatively cheap sdcard every 3/4 years is so bad, that said none of my cards have ever died and I have ancient 2GB well used cards and even older 4GB flash drives still going strong

I have only add this in /etc/fstab:
tmpfs /var/log tmfs nodev,nosuid,size=50M 0 0

and i use a blackberry power supply.

Is that enough?

Power quality has been mentioned. the other big thing I see is the quality of the SD card. A good brand name SD card (not a knock-off) should serve you well for years, if you think you'll be doing more than the average writing look for a "high endurance" SD card for a few bucks more.

1 Like

I've been given a PiJuice HAT for christmas which is now installed on my Pi-hole. Even with low-quality power supplies, the voltage stays perfectly stable now. I'm even able to power a small external USB drive through the Pi-hole's USB jack without any notable voltage drop.

Concerning brand vs. no-brand SD cards, things are not that straightforward and you can never be absolutely sure. I've been using a non-name 4 GB SD card with my RPi 1B+ which was running Pi-hole from several years without ever having a problem.

1 Like