Pi 4 keeps corrupting the SD card every few weeks running Pi-hole Storage
Third card in five months. It runs fine for two or three weeks, then DNS stops resolving and I find the root filesystem remounted read-only. Two of the dead cards were 32GB Samsung Evo Select, one was a no-name from a bargain bin, so it is not just cheap cards. Power is the official 5.1V 3A supply, nothing plugged in except ethernet, and the Pi lives on a shelf at room temperature. Is the Pi doing this to the cards or am I somehow buying bad ones every time?
@logfile_lena · 7mo ago · 2 replies
Before buying hardware, find out how much you are actually writing. Run
iotop -aofor an hour and it will name the culprit. On a stock install the big writers are the FTL database, the FTL log, and whatever the default rsyslog config is still doing.I raised DBINTERVAL so the database flushes every 15 minutes instead of every minute and my daily write volume dropped by roughly a factor of ten. Same card, two years, no corruption since.
Reply
Report
@null_pointer_ok · 7mo ago
Also worth setting MAXDBDAYS to 7 and deleting the existing database if it has grown to a few hundred MB. Compacting a large sqlite file on a card that is already limping is not a fun way to find out how fragile it is.
Reply
Report