Hi All, I’m trying to use my Raspberry Pi Zero 2 W as a Pihole server but after some weeks (2-3 weeks in general) the OS gets corrupted and I need to format the SD card with a fresh install of DietPi.
Initially I would leave the RPi running all the time without reboot but that resulted in corruption faster then with a daily reboot.
What I tried to do to prevent this from happening is to do a daily reboot with fsck check running at the start (enabled it tune2fs) to check for possible corruption but it wasn’t able to recover.
I’m trying to understand whether my SD card is just too cheap to be used for OS workloads and I should by for a new one, or if it is damaged and should be replaced or something else is the culprit.
I doubt the charger since it has plenty of room for powering a RPi Zero 2 W (or maybe I’m wrong?).
Now I’m wondering if I should try make the rootfs R/O but I’m not sure it can prevent corruption if the SD is that bad.
Thanks to anybody that can help clarify my doubts.
Moving the rootfs (/ partition) to external USB…they are usually alot more resilient than SD cards…I do believe dietpi has that built in to be able to boot from SD and run the OS from external USB/NVME drive
A regular SD card is not suitable for running OS.
There are special wear-resistant SD cards labeled Endurance/High Endurance/Pro Endurance—they are designed for dashcams but are also suitable for running OS.
An alternative to using a regular SD card is to use a rootfs formatted as F2FS (instead of EXT3-EXT4) — F2FS file system wears the SD card’s sectors evenly.
Is F2FS really better in this aspect? All mmc-based block devices have mandatory wear leveling, which is done unbeknownst to the operating system (as far as I understand). And F2FS has benchmark scores consistently worse than Linux alternatives. F2FS seems to be a relic from an era when flash memory devices did not have proper standards, and the fact that it’s still presented as such is beyond me. I’d stick to ext4 or maybe xfs, and leave the rest to the memory card. And yes, get a high endurance one.
Read again post, i send solution for you. And don’t forget to disable swap file. Things have been working for me for over three years (I had the same problem as you at the time) success.