Page 1 of 1

In-Car Use: SD Corruption?

Posted: Wed Mar 14, 2018 4:06 am
by Doogals
What is the likelyhood of corrupting the SD card’s file system when occasionally using an RPi 3 in-car where power supply is controlled by the car’s ignition?

SD card is a Samsung Evo Plus 32GB loaded with LibreELEC and used for media storage.

Would this be considered a read-only setup?

Re: In-Car Use: SD Corruption?

Posted: Thu Mar 15, 2018 12:42 am
by Doogals
Also if this is not considered a read only setup would it help changing the SD card to read only access?

Re: In-Car Use: SD Corruption?

Posted: Thu Mar 15, 2018 11:49 am
by NotRequired
As long as you can get stable 5v power for your Pi, you can (almost) use it anywhere and the SD card is no bigger concern in a car than it is in a wall plug. Getting stable voltage in a car can be an issue, though..

Re: In-Car Use: SD Corruption?

Posted: Thu Mar 15, 2018 12:10 pm
by texy
Is the Pi being shutdown in a controlled manner? Higher risk in a car than it not being closed down cleanly I would of thought.....

Texy

Re: In-Car Use: SD Corruption?

Posted: Thu Mar 15, 2018 12:14 pm
by thagrol
NotRequired wrote:
Thu Mar 15, 2018 11:49 am
As long as you can get stable 5v power for your Pi, you can (almost) use it anywhere and the SD card is no bigger concern in a car than it is in a wall plug. Getting stable voltage in a car can be an issue, though..
Not convinced. The main cause of SD card corruption appears to be cutting power with performing a proper shutdown on the Pi first. This is way more likely to happen in a car than with a wall plug.

Re: In-Car Use: SD Corruption?

Posted: Thu Mar 15, 2018 12:43 pm
by NotRequired
Power outages are bad for the SD card, no discussion about that. I did mention "stable 5v" and "can be an issue" about the car usage, and a clean shut down is required anywhere anyway so I assumed that was apparent. As long as the Pi draws power directly from the car battery (using a quality buck converter and a fuse), I cannot see any problem at all. Using the socket for the cigarette lighter (or any USB charging ports) may be an issue since they are not to be considered stable.

Re: In-Car Use: SD Corruption?

Posted: Thu Mar 15, 2018 12:51 pm
by RaTTuS
for car use use a battery backed UPS style circuit , so when power is removed it will go into shutdown mode, and when power is applied it boots up , if the power is removed while booting up the battery's need to have enough umph to finish the boot process then shut down cleanly [if it comes back on before finishing booting then all is good and it needs to stay up ...
this is for when you need to try and start twice in a row,

Re: In-Car Use: SD Corruption?

Posted: Thu Mar 15, 2018 1:29 pm
by thagrol
RaTTuS wrote:
Thu Mar 15, 2018 12:51 pm
this is for when you need to try and start twice in a row,
Or start it once if powering from the accessory circuit. That gets killed when you fire the starter motor.

Though I probably wouldn't go for a seperate UPS battery, I'd just tap a permanent feed of the vehicle battery for that (with a suitable circuit to cut it on shutdown - a latching relay combined with the gpio-poweroff device tree overlay might be enough).

Re: In-Car Use: SD Corruption?

Posted: Fri Mar 16, 2018 6:04 pm
by Doogals
I did consider a hardwired UPS solution to handle power for the Pi instead of relying on the ignition switch, but because this is a temporary setup that wil only used occasionally (and in different vehicles) I would like to keep it portable.

I’m thinking the Pi Zero W might be a better choice here because it only needs 1.2A and finding a 12V adapter to meet that spec is much easier.

With regards to SD card, does changing the file system to read only prevent corruption if the power is removed without a proper shutdown? Also if the card does become corrupted is it just a matter of reformatting, or is the card permanently unusable?

Re: In-Car Use: SD Corruption?

Posted: Fri Mar 16, 2018 6:25 pm
by NotRequired
A read only solution would lower the risk of data corruption significantly. However, this is not a guarantee that the SD card will survive power outages. Usually the corruption caused by power outages are only "file system related", meaning that a reformat will restore the cards functionality - but a hardware failure cannot be completely ruled out. I have never experienced hardware failures on SD cards due to power outages my self, though.

Re: In-Car Use: SD Corruption?

Posted: Fri Mar 16, 2018 6:38 pm
by Doogals
NotRequired wrote:
Fri Mar 16, 2018 6:25 pm
I have never experienced hardware failures on SD cards due to power outages my self, though.
So it sounds like worst case scenario would be permanent failure of the SD card and possibly the Pi Zero itself? I think this is acceptable risk considering the limited use of this setup and any lost data is media files backed up on another system.

Re: In-Car Use: SD Corruption?

Posted: Fri Mar 16, 2018 6:46 pm
by rpdom
Doogals wrote:
Fri Mar 16, 2018 6:38 pm
So it sounds like worst case scenario would be permanent failure of the SD card and possibly the Pi Zero itself?
The SD card, yes, that is possible, even likely. The Pi Zero? Very unlikely.

Re: In-Car Use: SD Corruption?

Posted: Fri Mar 16, 2018 6:53 pm
by NotRequired
The Pi does not take any damage from power loss. Transients and/or voltage spikes will however almost certainly kill it in an instant. The SD card is the issue here but if you prepare it for read only operation and you keep a backup (as an image) of the SD card, corruption in the file system should be easy to recover from. Hardware failure in the SD card is unrecoverable, though.

Re: In-Car Use: SD Corruption?

Posted: Fri Mar 16, 2018 8:25 pm
by Doogals
NotRequired wrote:
Fri Mar 16, 2018 6:53 pm
The SD card is the issue here but if you prepare it for read only operation and you keep a backup (as an image) of the SD card, corruption in the file system should be easy to recover from.
That is a really good idea, maybe even a spare SD card clone with the same image.

Here is a basic layout drawing of the setup:
3A7D29A0-97CE-441A-A18F-C469BF8A1250.jpeg
3A7D29A0-97CE-441A-A18F-C469BF8A1250.jpeg (60.38 KiB) Viewed 1447 times

Re: In-Car Use: SD Corruption?

Posted: Mon Mar 19, 2018 5:29 am
by Doogals
Follow-Up: I've uploaded a video of testing this setup that shows the voltage and current readings:

viewtopic.php?f=46&t=207962&p=1288231#p1288231