Doogals
Posts: 50
Joined: Sat Apr 02, 2016 8:55 pm

In-Car Use: SD Corruption?

Wed Mar 14, 2018 4:06 am

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?

Doogals
Posts: 50
Joined: Sat Apr 02, 2016 8:55 pm

Re: In-Car Use: SD Corruption?

Thu Mar 15, 2018 12:42 am

Also if this is not considered a read only setup would it help changing the SD card to read only access?

NotRequired
Posts: 190
Joined: Sat Apr 29, 2017 10:36 am
Location: Denmark

Re: In-Car Use: SD Corruption?

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..
Please do not ask questions in private messages, they will not help others.

texy
Forum Moderator
Forum Moderator
Posts: 5155
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: In-Car Use: SD Corruption?

Thu Mar 15, 2018 12:10 pm

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
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
thagrol
Posts: 1777
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: In-Car Use: SD Corruption?

Thu Mar 15, 2018 12:14 pm

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.
This space unintentionally left blank.

NotRequired
Posts: 190
Joined: Sat Apr 29, 2017 10:36 am
Location: Denmark

Re: In-Car Use: SD Corruption?

Thu Mar 15, 2018 12:43 pm

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.
Please do not ask questions in private messages, they will not help others.

User avatar
RaTTuS
Posts: 10406
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: In-Car Use: SD Corruption?

Thu Mar 15, 2018 12:51 pm

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,
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
thagrol
Posts: 1777
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: In-Car Use: SD Corruption?

Thu Mar 15, 2018 1:29 pm

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).
This space unintentionally left blank.

Doogals
Posts: 50
Joined: Sat Apr 02, 2016 8:55 pm

Re: In-Car Use: SD Corruption?

Fri Mar 16, 2018 6:04 pm

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?

NotRequired
Posts: 190
Joined: Sat Apr 29, 2017 10:36 am
Location: Denmark

Re: In-Car Use: SD Corruption?

Fri Mar 16, 2018 6:25 pm

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.
Please do not ask questions in private messages, they will not help others.

Doogals
Posts: 50
Joined: Sat Apr 02, 2016 8:55 pm

Re: In-Car Use: SD Corruption?

Fri Mar 16, 2018 6:38 pm

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.

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

Re: In-Car Use: SD Corruption?

Fri Mar 16, 2018 6:46 pm

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.

NotRequired
Posts: 190
Joined: Sat Apr 29, 2017 10:36 am
Location: Denmark

Re: In-Car Use: SD Corruption?

Fri Mar 16, 2018 6:53 pm

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.
Please do not ask questions in private messages, they will not help others.

Doogals
Posts: 50
Joined: Sat Apr 02, 2016 8:55 pm

Re: In-Car Use: SD Corruption?

Fri Mar 16, 2018 8:25 pm

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 1471 times

Doogals
Posts: 50
Joined: Sat Apr 02, 2016 8:55 pm

Re: In-Car Use: SD Corruption?

Mon Mar 19, 2018 5:29 am

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

Return to “General discussion”