Remix.run Logo
inigyou 2 days ago

Raspberry Pis are notorious for SD card corruption with unknown causes. In this era you might replace it with a mini-PC (NUC style).

danparsonson 2 days ago | parent | next [-]

Flash memory generally doesn't have great lifespan for repeated writes; using it as a root device is going to kill it pretty quickly. I had a similar problem once running a NAS off a USB stick; within a year of so the stick would no longer accept new data and I swapped it out for an SSD instead.

inigyou 2 days ago | parent [-]

Yeah but it's also SD cards in particular and Raspberry Pis in particular.

whartung a day ago | parent | next [-]

Are there other computers that run off of SD cards long term successfully that are not Raspberry Pi’s?

Palomides a day ago | parent | next [-]

I work on embedded linux machines that go a decade plus in active use with micro sd cards, it's not a problem at all

Nextgrid a day ago | parent | next [-]

I suspect most of the "corruption" RPi users experience is likely bad power (shitty undersized USB power bricks) glitching the CPU and causing the filesystem to corrupt. The SD card is likely doing exactly as it's being told by the host system - write (invalid) data to blocks, which it does.

DJBunnies a day ago | parent | next [-]

I had more than my fair share of SD failures running pis off their official power supplies.

It really is a high failure rate.

marysol5 16 hours ago | parent | next [-]

"Enterprise" Boot SD's in servers love to die.

More than likely due to being in a warm box...

mattrighetti a day ago | parent | prev [-]

Do pis have an official power supply?

rmunn a day ago | parent [-]

Yes. https://www.raspberrypi.com/products/power-supply/

I have always bought the official power supply, yet of the two Pi 3s that I have connected to my TV at home, the one that runs Kodi/OSMC to serve up movies has never suffered any filesystem corruption, despite it suffering repeated power outages without warning (it's low enough to the ground that the toddler has often pulled the power cable out, and I haven't been able to find a better place to keep it). The other one, bought at the same time from the same source, is meant to be the one the kids use for programming in Snap!, a variant of MIT Scratch that doesn't have the artificial limitations that Scratch has. (Snap! functions — the exclamation mark is part of the name — can take lists as input, whereas Scratch functions can only take numbers or strings, giving it an artificial ceiling; also, Snap! functions can take functions as input and return functions, making higher-order programming possible, while Scratch deliberately does not allow that). However, that Raspberry Pi has suffered two SD card failures in the past year; it's been down more often than it's been up, and I've ended up using either my laptop or my wife's laptop for my kids' programming lessons.

marcosdumay a day ago | parent | prev [-]

I've had enough SD and micro-SD cards die on phones and cameras to doubt that is the only problem.

People probably see more of a problem on raspberry pis because they write more to the memory than other systems.

marysol5 16 hours ago | parent [-]

Reminds me of years ago, I had to send a load of photos to a client of something I'd travelled 5 hours to photograph.

Didn't even check, just took and sent. Then went back.

Only to find that the SD card in the phone was dying, and every image was corrupted from about 1/3 down...

ErroneousBosh a day ago | parent | prev [-]

It's actually weird that Raspberry Pis seem so bad at using SD cards.

I've just scrapped a large PBX which had a whopping 8MB SD card in it. Its 486 processor booted Linux off the SD card, it wrote CDRs to the SD card, it served said CDRs up over a web interface off it, it saved its logs to the card, and all the other day-to-day chatter of a running system.

It was installed pretty much 20 years ago. The date sticker on the SD card shows that it was replaced 18 years ago, presumably as part of an upgrade.

SahAssar a day ago | parent | next [-]

I'm going to guess that it was not a normal COTS SD card, and instead designed for continuous writes.

The factors for SD card failures in raspberry pi seem to be mostly SD cards not meant for the purpose and having things like swap, atime or disk logs enabled which leads to unnecessary writes.

ErroneousBosh 19 hours ago | parent [-]

It just appears to be a pretty standard Sandisk SD card.

marysol5 16 hours ago | parent | prev [-]

Because of a properly configured, boot disk. Just boots once per power cycle.

Meanwhile something like the pi, on most images, is writing logs to the storage CONSTANTLY. Not to mention is regularly booted.

ErroneousBosh 13 hours ago | parent [-]

This was constantly writing to the SD card. It was the only storage on the device.

Rebooting it was a big deal though, so that rarely happened.

Spooky23 a day ago | parent | prev [-]

We “lost” a signage device in a facility we were doing an IoT refresh on.

It was an old wyse terminal, and at some point a CF adapter with an SD card was added, and a construction project buried it inside of a block wall. lol. It’s still there.

marysol5 16 hours ago | parent [-]

Been there before, the amount of times when you're in shared spaces that you come one day to find your kit disconnected, or even outright buried.

We came one day to a plant room where our rack was, to find it was in an entirely different "room", with a locked door....

mDyJzDPmBdG 17 hours ago | parent | prev | next [-]

I found GoPros to cook SD cards from time to time. It makes me wonder if normal sized SD are still manufactured and are they more resistant. For years in stores I only saw miro SD with adapter to full size.

tuatoru a day ago | parent | prev | next [-]

Early on Raspbian didn't specify noatime or even relatime; every time something was read off disk, a write happened.

Let alone things like putting /var/tmp and/or /var/log in RAM, or long commit intervals.

No idea what the current situation is; Pis are too dear for the likes of me now.

PunchyHamster a day ago | parent [-]

> Early on Raspbian didn't specify noatime or even relatime; every time something was read off disk, a write happened.

relatime is a default for a while now, like decade+, you don't need to set up mount option just to get relatime

close04 a day ago | parent | prev [-]

I’ve had the same issues in the Pi1-3 era, can’t say for sure if it was the Pi, the SD card, or the software running on top (HA was a big culprit). The last issues were probably before 2018-2018. Since then I don’t remember having any failure and I have a bunch of Pi3s and 4s running with flawlessly for about that long, including HA.

Since then I’ve been careful to buy high quality cards, oversized them a bit, optimize the OS and apps with regards to writes (like no unnecessary logging), and paid attention to airflow. The software probably also evolved to fix the issues.

1vuio0pswjnm7 a day ago | parent | prev | next [-]

"Raspberry Pis are notorious for SD card corruption with unknown causes."

This is not specific to RPis. When an SD card is subjected to "unpredictable" writes it creates potential risk of corruption. The writes are triggered by software, not the RPi hardware

There is no rule that says the RPi user must mount the root filesystem r/w on the card. It can be mounted r/w on mfs or tmpfs, for example, and the card can be removed after boot. Been doing this since 2012

Zero writes to the card, no corruption

It's true these corruption issues are "notorious" but that's due to RPi owner behaviour, not the RPI hardware

1vuio0pswjnm7 8 hours ago | parent | next [-]

"Install an OS onto boot media

To use your Raspberry Pi, you must first install (flash) an operating system (OS) onto your storage device, making it a boot device. By default, Raspberry Pi devices check for an OS on any SD card inserted into the SD card slot. Some Raspberry Pi models allow you to boot an OS from other storage devices, such as USB drives, storage connected through a HAT, and network storage. The following instructions assume that you're using a microSD card.

We recommend installing an OS to your storage device using Raspberry Pi Imager on another computer. For instructions, see ~Install using Imager. If you don't have access to another computer for writing an OS image to the storage device, you might be able to install an operating system directly on your Raspberry Pi from the internet. For instructions, see ~Install over the network."

https://web.archive.org/web/20260715154847/https://www.raspb...

What is the difference between a "recommendation" and a "default"

Here, we can see that this is a recommendation not a default

The owner must make a choice

The company has not pre-selected a default choice

It has only provided recommendations

Contrast "defaults" with "recommendations"

The former is opt-out; a choice has already been pre-selected by the company

The later is opt-in; no choice has been pre-selected, a choice must be made by the owner

1vuio0pswjnm7 8 hours ago | parent | prev | next [-]

The reason for this comment is that the parent cites "Raspberry Pis" instead of "the software and configuration recommended by the Raspberry Pi vendor"

The recommended software, derived from Debian,^1 and the default configuration of that software is what causes the SD card corruption, not the RPi development board

1. If I am not mistaken the OS recommendations have changed since the RPi was released, e.g., the company was originally recommending RISC OS. Challenge me on this and I'll find the reference

1vuio0pswjnm7 a day ago | parent | prev | next [-]

By "RPI owner behaviour" I mean the decision made by the RPi owner in choosing what operating system software to run and how to configure it

When I bought RPi Model B the hardware did not come with an OS pre-installed

It booted only from SD card

It was up to me to choose which OS to run. I did not choose any of the "recommended" operating systems. I was already booting other "diskless" computers using USB sticks with root mounted on tmpfs so I wanted to use that same OS for the RPi

I never experienced SD card corruption with RPi hardware

However I have experienced SD card corruption with other SBCs that had an OS pre-installed, an OS not chosen by me

By choosing to run a "recommended" OS on the RPi perhaps I would experience SD card corruption

But if that happened I would not attriubute it to the RPi. I would blame myself. And I would make different choices going forward

mvdtnz a day ago | parent | prev [-]

And when you say "due to RPi owner behaviour" what you're saying is "due to the default setup". It's a Raspberry Pi problem. The devices are notorious for this issue for good reason.

marysol5 16 hours ago | parent [-]

Default setup is 100% softwareless

natebc 14 hours ago | parent [-]

... and the default instructions guide you to install the Raspberry Pi Imager which will format and configure an SD card for your hardware.

The recommended OS during this process is .... "Raspberry Pi OS" i.e. Raspbian.

billfor a day ago | parent | prev | next [-]

I have a rasperry pi 2 and 4 that have been running on the same size uSD (reputable brand) for 5 years and haven’t had any issues. I have swap turned off. You just have to be aware of the i/o and not do anything stupid. Clearly for heavy i/o with multitasking they are not ideal.

You can buy cards that support SMART if you want to track wear, but they are expensive.

dwedge a day ago | parent [-]

My 3 Pis have destroyed 6 SD cards. One of them also somehow drew too much power when trying to boot and got so hot it burnt me and melted itself but that could have been the power supply. I know the 4s and 5s can blow SD cards if you run them without heatsinks.

What I'm saying is, your anecdotal evidence of two pis doesn't justify saying we did something wrong with the configuration. In my experience raspberry pis still behave like "throwaway devices" but their price tags do not justify it anymore.

BobbyTables2 a day ago | parent | prev | next [-]

I suspect it isn’t the hardware but the bullheaded approach of running a desktop Linux environment from an SD card.

hackmiester a day ago | parent [-]

You suspect correctly. Embedded applications are less affected, and mounting the card r/o solves the problem completely.

exadeci 13 hours ago | parent | prev | next [-]

You can flash them to boot on an USB drive so any ssd, I have a RPI4 that had the sdcard slot ripped, flashed an sd card to instruct it to boot on usb, held it against the pins and now it boots without any sdcard.

Though I'd agree that if you got none the NUC is the better solution as if you add an ssd and power supply to the PI it becomes as if not more expensive for less power

traceroute66 a day ago | parent | prev | next [-]

> Raspberry Pis are notorious for SD card corruption

True SD cards are less than ideal.

But also I suspect half the problem specifically with Pi and SD cards is that people use cheap-ass SD cards and maybe ones they found in the bottom of a drawer that may or may not have previously been used in another device (e.g. camera).

I suspect if people bought industrial SD cards instead of consumer-grade junk they might get a better lifespan out of them.

hecifato a day ago | parent [-]

I used to get Sandisk cards but recently I stopped using SD cards altogether. When it came time to update from Debian 12 to 13 for my Pi4 I migrated to an NVME USB enclosure for my boot drive. Just yesterday I set up another Pi4 for a project with an M.2 SATA enclosure and in both cases they work just fine.

Havoc a day ago | parent | prev | next [-]

Alternatively cheapest fix is an m10 optane and nvme enclosure. You maybe need to enable usb quirks in the kernel depending on on enclosure. Costs about 20 bucks all in

That’ll keep the rasp online for essentially forever cause optane isn’t going to wear out

throwaway270925 10 hours ago | parent [-]

> cheapest fix is an m10 optane > Costs about 20 bucks

I agree that its a good, long-lasting fix, but when was the last time you checked the pricing on those?

If you can even find any, they certainly wont be cheap nowadays!

baq a day ago | parent | prev | next [-]

I’ve got an rpi4 booting from an usb ssd and bought a n100 minipc anyway… last February for $150. Should have bought a 40ft container of these

Lord_Zero a day ago | parent [-]

I regret selling mine

marysol5 16 hours ago | parent | prev | next [-]

More just that lots of standard images don't bother with tmpfs for logging. So all that IO onto the disk kills them

plasticchris 2 days ago | parent | prev | next [-]

Make the sdcard a read only root fs, problem solved

inigyou 2 days ago | parent | next [-]

Doesn't actually help. It eventually goes corrupt anyway. It might be related to power ripple or something.

Makes it easy to replace, though.

plasticchris a day ago | parent [-]

Could be some other hardware issue for you, yeah. I recall there are some problems that can happen if the usb power supply is too weak. But this fixed it for me.

steinuil a day ago | parent | prev [-]

Yeah that's more or less my goal for the setup in the post... I didn't have much time to investigate what else I could move off of the SD card but I suspect there's a few other things I could do. NixOS makes it super easy too.

nubinetwork 2 days ago | parent | prev | next [-]

Can confirm, I've got a pi 5 here that's been running 24/7 for over a year (possibly two)... it boots fine, but anything else makes it run so slowly because the sdcard is trashed.

The current setup writes to the systemd journal at least twice every minute... It's next iteration is getting a proper nvme.

b112 a day ago | parent [-]

Ho-ho my friend! You want to buy storage for your computer before 2030? I'm so sorry, but you now pay big time, now you sell your car for one nvme drive.

Somebody set up us the bomb.

Dylan16807 a day ago | parent [-]

There is no need to bring this up on every mention of buying a computer part. And this is also very wrong. TLC nvme drives go below $40, and the smallest ones have more than enough storage for a pi.

b112 17 hours ago | parent [-]

This is the first time I've every brought this up, ever.

Dylan16807 8 hours ago | parent [-]

So when I say "every mention" I'm not talking about how many times you in particular did so, it's about it being brought up a lot and this being a completely unrelated post that really doesn't need the complaint.

b112 3 hours ago | parent [-]

I didn't notice it being brought up a lot, but also, it wasn't a complaint. It's a joke. Most specifically, taking what is supposed to be cheap compute, and adding something made super expensive is just funny.

celsoazevedo a day ago | parent | prev | next [-]

My issues with Pis and SD cards ended when I switched to using SSDs as boot drive.

0xc133 a day ago | parent [-]

I discovered that barely-used enterprise Intel SSDs (DC S3610, S3700, S3710) were cheap on ebay a year or so ago and I may have bought a few dozen. These things have remaining endurance measured in petabytes. Sure, it’s overkill to have a 200GB enterprise SATA disk as the boot volume for a Raspberry Pi, but this is exactly my kind of overkill.

bitwize a day ago | parent [-]

Yeah, as soon as I was able I upgraded my Pi 4s to be able to boot USB and used an SSD in an enclosure as my main boot volume. Works rather well.

andruby a day ago | parent | prev | next [-]

I'm super happy with an Odroid H3 as a NAS: low power usage, silent, x86, nvme + 2 sata ports. Runs home assistant, smb shares and a few more things

TacticalCoder 5 hours ago | parent | prev | next [-]

Yup and I read TFA and it's not clear: "The death and rebirth of my home server" and, somehow, his Raspberry Pi is his server!? Running RAID, I'm Mich (immich), Jellyfin, etc. all from a Pi is amazing.

Don't get me wrong: I've got like seven Pis, 4 NUCs (but only one "recent" N100 one) and even though two of the Pis are up 24/7 (one runs the unbound DNS and the other, well, serves as a router/firewall to isolate my main PC from the rest of the machines) my server, as in the machine that has disks in RAID (ZFS), runs VMs, containers (including Immich and Jellyfin), etc. is a Xeon with ECC RAM.

I had no idea a Pi 4 was that beefy.

Now of course booting off a microSD card: yuk (I know, I know, there are read-only trickeries that can be achieved).

> The important stuff mostly lived in external HDDs and the configuration lived almost entirely in my NixOS configuration.

Yeah NixOS or what-have-you: if you have server, I'd recommend you have a plan B for when it fails. My little infra at home is mostly automated: it's all scripts provisioning the VMs, setting up cloudinit for the first boot, etc.

As long as I've got backups of my config/scripts and of my data, setting up a new server really doesn't take long (heck I did it not long ago, mostly to be sure the "death and rebirth" procedure of my own server was sound).

I personally prefer my 10+ years old Xeon with ECC as a server than my N100 NUC but then the Xeon consumes more energy... YMMV.

rustyhancock a day ago | parent | prev [-]

Just have the raspberry pi boot from a USB/SSD.

Rpi5 has a pcie slot if you want a cleaner setup.

b112 a day ago | parent [-]

Really would just prefer a working, non-buggy, Pi2 maybe without all the crazy extra power + compute + RAM. Or at least have the option, because $20 is more my style for a lot of these tasks, not $150CDN.

wildzzz 12 hours ago | parent [-]

I dug up my Pi2 for a project the other day. The plan was for it to be a USB serial to network bridge for up to six devices and to use ZMQ pub/sub for passing commands and telemetry. Most telemetry strings were only 500B but I sometimes see two sequential 32KB mega strings for dumping data. The Pi was choking on the mega strings and they were getting cut off early. I spent forever trying to debug this and eventually figured out it was a hardware issue when the code ran fine on a modern PC. I tried a few tricks to get the Pi to cache more USB data before giving up.

I bought an old Lenovo M92 on eBay, threw in an old 500GB HDD, and it worked perfectly for the job. I had thought about just buying a newer Pi but the 14 year old Lenovo offered better specs at only $38. I promptly bought another more modern version for $100 for my desktop.

Based on benchmarks for an identically specced machine [1], a new Pi 5 edges out on single core performance and TDP but gets beat badly on multi-core and price (4-5x, even on eBay!). There also would have been the extra cost of buying a case for the Pi. I could have spent even more money on a newer mini PC that blows the Pi 5 away entirely. Obviously a Pi (even a Pi 2) is plenty capable of many tasks, I have a Pi 3 running my home assistant but it's hard to justify the extra cost over surplus thin clients that can be purchased for much less. The Pi does have its GPIO bank that's just not offered on any mini PC but I can barely remember how many times I've needed both GPIO and a whole PC-like stack to run code, an ESP8266/32 have worked fine. An external PCIe bus is cool but again, unless you're doing some really unique edge computing, not really much of a selling point.

Power consumption is a concern but they are both so low that unless you're operating off a battery, power consumption is negligible relative to everything else in your house. It would take 2 years to make up the difference in price running at full TDP (38 vs 12W). 38W is low enough that fan noise is barely a concern as well.

Size is also a concern but the difference in size is negligible unless you're trying to cram as much compute power as possible into a mini rack. A mini PC is probably the same size as your home router so just put it there.

I just really can't see the need for running the full size Pis anymore. An old mini PC does a better job for cheaper for server tasks. A Pi Zero 2 or even a Pico are much more inline with the classic Raspberry Pi ideology.

[1] https://browser.geekbench.com/v6/cpu/compare/4383152?baselin...

b112 3 hours ago | parent [-]

Yeah. I agree. The older Pis did have their limitations, to be sure. But you're hit the nail on the head, a modern but still cheap Pi is very doable. Fixed design flaws, lower RAM still, lower power too!, and just.. cheap compute.

But other avenues exist now, including just old hardware.