emarsh
Posts: 7
Joined: Wed Feb 03, 2016 2:45 am

Properly down a Pi

Sat Feb 27, 2016 4:01 am

Hello,

I'm working on a Pi project for aircraft and it occurred to me that when the device is turned off it might not be done gracefully (i.e. yanking the plug or flipping off a power switch). I get it that normally a halt command should be done on a Linux computer to flush all the buffers and things down properly. Is this an issue that I need to be concerned about?

Thanks,

Eric

User avatar
rpdom
Posts: 16107
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Properly down a Pi

Sat Feb 27, 2016 5:37 am

Yes, you should be concerned.

Removing the power without shutting down cleanly can lead to filesystem damage (which is quite often repairable), or in the worst case some corruption of the SD card itself - on rare occasions this can be bad enough to make the card unusable.

HankB
Posts: 127
Joined: Fri Jan 01, 2016 2:45 pm

Re: Properly down a Pi

Sat Mar 12, 2016 4:13 am

Do it often enough without a proper shutdown (to bring the disk to a consistent state) and at some point it won't boot.

Do you need to save information from one execution to the next? If not, run the system off a read only drive. Then there should be less (or no) chance of corruption on loss of power.

Another alternative is to provide some sort of backup power and a way for the Pi to detect loss of power so when that happens, it has enough time for a graceful shutdown.

Return to “General programming discussion”