Raspberry PiTroubleshooting

Why Your Raspberry Pi's SD Card Keeps Corrupting (And How to Stop It)

If you've reflashed the same Pi three times in a month, the card probably isn't the problem — something in how it's powered or shut down is. Here are the four real causes, roughly in order of how often they're actually to blame.

Ad space

Cause 1: An underpowered supply (the most common, and the most missed)

This is the one people rule out first and shouldn't. A Pi that isn't getting enough current doesn't simply switch off — it browns out. Voltage sags below what the board needs, and if that happens mid-write, the card is left in an inconsistent state. Do that enough times and the filesystem gives up.

What makes it sneaky is that the symptoms don't look like a power problem. You get random freezes, apps crashing, USB devices dropping out, and eventually a card that won't boot. It reads like a software fault or a bad card.

What you actually need

A phone charger and a spare USB cable is the classic failure combination. Even a charger rated for enough current may not deliver it at a stable voltage through a thin cable — a long, cheap USB cable can drop enough voltage along its length to matter. If you're diagnosing this, change the cable as well as the charger.

Raspberry Pi OS will tell you if it's unhappy: you'll see a lightning bolt icon in the corner of the screen, or undervoltage entries in the system log. Check with:

vcgencmd get_throttled

A result of throttled=0x0 means no problems detected. Anything else means the Pi has recorded an undervoltage or throttling event — and you've found your culprit.

Cause 2: Pulling the plug instead of shutting down

A Pi is a full computer running Linux, and it buffers writes in memory before committing them to the card. Cutting power skips that final write. You'll get away with it most of the time — which is exactly why the habit forms — but every hard power-off is a roll of the dice.

Always run:

sudo shutdown -h now

and wait until the green activity LED stops flickering before removing power.

If your Pi lives somewhere awkward to reach, wire a physical shutdown button to a GPIO pin and a small script — it turns a two-step process into one press, which is usually enough to make the good habit stick. (PinTinker will find you a free pin for it.)

Cause 3: Cheap or counterfeit cards

Fake SD cards are genuinely common in online marketplaces — cards that report a large capacity to the operating system but contain far less real storage. They appear to work fine until you write past the real capacity, at which point data silently disappears and the filesystem breaks.

Two practical defences:

Look for cards rated A1 or A2 — that rating specifically covers random read/write performance, which is what an operating system does constantly, as opposed to the sequential speed a camera cares about.

Ad space

Cause 4: Write wear from constant logging

Flash memory cells wear out after a finite number of writes. For ordinary desktop use this is rarely the limiting factor — but a Pi running a project that writes continuously (a sensor logging every second, a security camera, a busy database) can chew through a card's life in months rather than years.

If that's your use case:

The one habit that makes all of this survivable

Once you have a Pi configured the way you want it, take an image of the card and keep it somewhere safe. The Raspberry Pi Imager tool, Win32 Disk Imager, or dd on Linux and macOS will all do it.

Corruption then stops being a lost weekend of reconfiguring and becomes a ten-minute reflash. It's the difference between an annoyance and a disaster, and it costs you one evening to set up.

Gear that helps

An official Raspberry Pi power supply eliminates the single most common cause on this list, and costs less than the time you'll spend diagnosing it. A good-quality A2-rated microSD card from a reputable brand handles causes 3 and 4, and a USB SSD enclosure is worth it for any Pi that runs 24/7.