I'm new to both Raspberry PI and Linux. I'm using my RPI with Raspian on an SD card and I'm wondering if this behaviour I have observed is normal or not. The thing is that I have to reformat my SD card and reinstall Raspbian every time I do an improper shutdown, that is when I straight up pull the plug without issuing a shutdown command to the OS first. After doing so I am greeted by this screen when trying to boot:

a busy cat
(source: forumbilder.se)

What I wish to know is if this is expected behaviour, maybe Linux is unable to handle this kind of shut down without essential files getting corrupted or something? But it seems kind of outrageous that a power outage would equal a corrupted OS.


I agree with the comments by @goldilocks and @joan.

In over 2 years with 3 Pis I have only had 2 failures requiring re-imaging cards (other than user induced problems) and 1 requiring reformatting cards - the latter was an error related to an upgrade attempt, not power related.

I have often had power failures, and sometimes power off without shutting down. In all cases the file system has been repaired on startup. Ext4 is a journalling filesystem, and quite good at recovery.

I can suggest one solution; get a new SD card from a reputable manufacturer. Some cards seem to be more susceptible to this problem. I use Sandisk cards.

NOTE most SD card manufacturers recommend against using them for an OS, but that is not an option for the Pi.

Further note. OS corruption is not a problem specific to the Pi. Pulling the plug on any OS risks HD corruption. It used to be a real problem 30 years ago with DOS and pulling the plug on an old Windows machine invariably caused problems. Most modern computers have hardware to prevent this, but this is not there in the $25 Pi.

| improve this answer | |

No, it's not normal. Although the potential is always there for the root file system to end up corrupted if the power is suddenly cut, the chance of this leaving the system unbootable is pretty small. In 15+ years of linux and ext2/3/4 use, including perhaps hundreds of power kills, I can't remember seeing it happen, or at least, not to the extent that a simple fsck didn't fix the problem. That includes the pi. I agree with joan that you should avoid doing this, but I admit that I regularly pull the plug when I've screwed something up with a headless pi and am simply too lazy to get a screen and keyboard,1 and I occasionally let them die on a battery.

However, most of my power kills have been arbitrary on a system that was likely idle at the time (literal power outage), or else because the system locked up to due to either driver bugs, kernel experiments gone wrong, fork bomb style out-of-memory problems, or I/O errors on a storage device that was broken. Under these conditions the filesystems would probably be synced after a few minutes. Point being, I haven't seen it happen to a extremely busy but properly functioning machine very often.

There do seem to be a handful of people who report peculiar problems like this here. They repeatedly end up having to repair the filesystem or re-flash the card. Make sure the image you are using is relatively recent (2015); there may have been a kernel bug from 2013-14 that could produce arbitrary corruption.

There are even people who've reported corruption using a read-only file system, which implies that some pis have an electrical problem with the SD card. If the chance of this happening were increased when the card is busy and the power is pulled, it would explain why some people are plagued by this kind of problem and other people never encounter it.

1. Here's a suggestion about how to deal with that if it happens to you a lot.

| improve this answer | |

Well it is certainly normal for your set up if it happens every time.

I suggest you take the hint and shutdown propely before you yank the power.

You will get corruption if you are in the habit of writing lots to the SD card and leaving files open.

I don't leave files open and I minimise logging and I can't remember the last time I had such a problem. More than a year at least.

SD cards are particualrly sensitive to having the power pulled when they are writing. As you have discovered you can easily corrupt the file system.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.