Page 1 of 1

SD cards keep getting corrupted

Posted: Thu May 14, 2020 11:03 am
by steve1000
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!

Re: SD cards keep getting corrupted

Posted: Thu May 14, 2020 11:39 am
by ElEscalador
Are you clicking the "shutdown" button or just pulling the plug?

Re: SD cards keep getting corrupted

Posted: Thu May 14, 2020 11:49 am
by steve1000
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.

Re: SD cards keep getting corrupted

Posted: Thu May 14, 2020 12:36 pm
by ElEscalador
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.

Re: SD cards keep getting corrupted

Posted: Thu May 14, 2020 4:19 pm
by wildfire
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?

Re: SD cards keep getting corrupted

Posted: Fri May 15, 2020 9:04 am
by steve1000
Ok, I found a solution.
I enabled the overlay fs for the boot drive and everything works nicely