Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Every time I've tried to use a pi as a long-lived server, the SD card ends up getting corrupted. Switched to a chromebox running kodi for my media server, running 24/7, five or six years ago and haven't had a single problem with it.


SD card corruption is a big problem with the Pi, but its easily solved: enable the read-only overlay for your boot/root filesystems. This is built into the RPI OS. start raspi-config, and go into performance options.

Every month or two, disable the overlay (again using raspi-config), reboot, apply updates, re-enable the overlay, and you are good to go.

Also, if you are using a PI4, switch to booting from a USB stick and just forget about the SDcard.


They also support netbooting now I believe. Been meaning to try it out so I can fully host my retropi on my NAS.


Thanks! This is handy to know. All the guides I've seen earlier involved a lot of manual config.


when did that option appear? that is great info.

(I've been running openwrt on a pi just because it had an overlay filesystem - I could run raspbian now)


I had trouble with that on the original models, even with a good (or at least official) power supply (many reported the issue was worse with cheaper USB power sources).

Never had trouble with the 3 that was a Kodi box and latterly has been used for some electronics experiments, the 4 that is my current Kodi box, or the 400 that has been playing as router+firewall+VPN since early this year (at the time getting a 3 or 4 for the job would have been either expensive or near impossible, and I didn't want to try a potentially less well supported option, but I spotted a nice offer on a 400).


You are probably (or, the default config) doing "something stupid", like atime, or something that writes continuously to the fs, like logs, etc

(I'm not blaming you, it's hard to have a pure RO FS, that would help a lot - and a standalone RPi doesn't need a lot of stuff that comes by default)


In addition to the other helpful suggestions you’ve received, look into using Log2Ram. It does what it sounds like, puts log writes in ram and then writes them to disk on a slower cadence that doesn’t work your SD card that much.

https://github.com/azlux/log2ram


I have rpi4, installed almost 3 years ago on 64GB Sandisk SD card. I also have attached external storage. Still alive with tons of doker services.

I have /var/log and /var/tmp on tmpfs tho


Yeah, I won't buy it until it has a bit of flash memory on it.

And I don't need much, just 32MB would be enough, I would just boot linux using using a read only SD card.

It's a major flaw, I don't understand why they did not find a fix yet.


There are Pi CM4 SKUs that have onboard eMMC flash - I have one that I use on a carrier board that also has a SATA controller and two SSDs connected.


If you have a workload that writes data quite frequently, then moving that data off to an external SSD is also a good way to extend the lifetime of the SD card.


You can boot directly off the ssd, i dont even have an sd card installed


That's true, I forgot that was a feature they supported with the newer Pi-s. Doesn't work for Pi 1, you can move the root partition to the SSD, but anything needed for the initial boot still has to live on the SD card.


I starting using a usb-3 nvme adapter instead of an sd-card for my always-on pi 4, and haven't had any issues since.

It boots in about 10s now too.


Try a Beagle Bone Black




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: