steve1000
Posts: 3
Joined: Thu May 14, 2020 10:48 am

SD cards keep getting corrupted

Thu May 14, 2020 11:03 am

Hi all,

I'm fairly new to the raspberry and am a bit overwhelmed.

Here is my situation:
I am building a photogrammetry 3d scanner / cam array containing 60 ESP32s and 10 Raspberry Pi Zero Ws running Debian lite on cheap 16GB cards.
I power each module via pins from a stable 5V/40A PSU.
My scripts perform like they should BUT when after removing power from the system multiple Pis have corrupted SD cards.

I figure that the corruption comes from write processes during "shutdown".

My attempted solution so far:
- Load /var/logs as ram drive
- Write temporary image files to ram drive
does not work.

Is there maybe a safer approach? Are there other processes writing to storage? Any tips in general?

Thanks for your time!

ElEscalador
Posts: 839
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA
Contact: Website

Re: SD cards keep getting corrupted

Thu May 14, 2020 11:39 am

Are you clicking the "shutdown" button or just pulling the plug?
Robotics tips, hacks, book extras https://youtube.com/practicalrobotics

steve1000
Posts: 3
Joined: Thu May 14, 2020 10:48 am

Re: SD cards keep getting corrupted

Thu May 14, 2020 11:49 am

I am just pulling the plug.
I do have a dedicated "sudo shut down now" available via UDP, but it does not seem to fix the issue.

ElEscalador
Posts: 839
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA
Contact: Website

Re: SD cards keep getting corrupted

Thu May 14, 2020 12:36 pm

Just pulling the plug definitely leaves you at risk for killing power mid-write to the sd card which is the big corruptor. I thought sudo shutdown ensured everything was done...perhaps the -h (as in sudo shutdown -h now) is necessary to ensure everything has stopped, although I haven't had a problem without the -h.
Robotics tips, hacks, book extras https://youtube.com/practicalrobotics

wildfire
Posts: 606
Joined: Sat Sep 03, 2016 10:39 am
Location: Dundee, Scotland

Re: SD cards keep getting corrupted

Thu May 14, 2020 4:19 pm

A few things I noticed in this thread...

1) "Cheap 16Gb cards, I guess that depends on your definition of Cheap.

2) "just pulling the plug", Defiantly a major cause of corruption.

3) Assuming this is a typo "sudo shut down now" (there is no space between shut & down), are you allowing enough time for a proper shutdown before pulling the plug?
E8 85 A2 64 C9 64 81 94 64 81 95 64 89 84 89 96 A3
Still NF Shirls

steve1000
Posts: 3
Joined: Thu May 14, 2020 10:48 am

Re: SD cards keep getting corrupted

Fri May 15, 2020 9:04 am

Ok, I found a solution.
I enabled the overlay fs for the boot drive and everything works nicely

Return to “Beginners”