JohanSA
Posts: 40
Joined: Mon Jun 17, 2013 8:08 am

Corrupted SD cards

Mon Jun 17, 2013 8:22 am

Hello

What could possibly cause SD cards to become corrupted? I have 6 SD cards of which 3 have become corrupted. One of the three that was corrupted was working fine, then i decided to remove the power supply (so as to reboot the pi) and i put the power supply back in and suddenly the SD card was corrupt.

Any ideas? Anyone else experiencing this?

MrEngman
Posts: 3844
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Corrupted SD cards

Mon Jun 17, 2013 9:08 am

If you've switched off the power without shutting down first then I'm not surprised you're corrupting your SD cards.

Before removing power you need to stop the Pi. There are several commands you can use. I normally use -

sudo shutdown -h now

This will shutdown the Pi and put it in a safe state to remove the power.


MrEngman


EDIT: if you want to reboot use the command sudo reboot - just don't unplug the PSU.
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

JohanSA
Posts: 40
Joined: Mon Jun 17, 2013 8:08 am

Re: Corrupted SD cards

Mon Jun 17, 2013 9:57 am

Thank you. After posting i read up on shutting down the pi and realised that i corrupted it.

How can someone shut off the pi if they canno connect to it? The problem i have is that there are many users in the area where i have the pi and they sometimes want to switch it off for the weekend but they do not access to connect to the pi.

is there a way around this?

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Corrupted SD cards

Mon Jun 17, 2013 10:01 am

Over clocking and less than magnificent power supplies are also good for mincing the contents of SD cards (I suspect cutting edge SDs card don't do themselves any favours either ). I have 5 pis, often deprived of power without warning, never had a corrupted SD card. But I don't seriously overclock, use Sandisk class 4 8GB SD cards and my power supplies are up to scratch (measured with a meter, I'm long past believing what it says on the label).
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Corrupted SD cards

Mon Jun 17, 2013 10:06 am

JohanSA wrote:Thank you. After posting i read up on shutting down the pi and realised that i corrupted it.

How can someone shut off the pi if they canno connect to it? The problem i have is that there are many users in the area where i have the pi and they sometimes want to switch it off for the weekend but they do not access to connect to the pi.

is there a way around this?
It happens all too frequently, but I don't suffer corrupted cards.....
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

JohanSA
Posts: 40
Joined: Mon Jun 17, 2013 8:08 am

Re: Corrupted SD cards

Mon Jun 17, 2013 10:31 am

I cannot see what else is causing this. I do not think the software has anything to do with the corruption

User avatar
malakai
Posts: 1382
Joined: Sat Sep 15, 2012 10:35 am
Contact: Website

Re: Corrupted SD cards

Mon Jun 17, 2013 10:38 am

2 switches exist http://mausberrycircuits.com/ are in full production got mine a month or so ago from the Kickstarter. http://www.pi-supply.com/product/pi-sup ... er-switch/ still awaiting this one but should be getting very close to production. Might want to drop them an email if your looking to purchase to make sure there are no delays.
http://www.raspians.com - always looking for content feel free to ask to have it posted. Or sign up and message me to become a contributor to the site. Raspians is not affiliated with the Raspberry Pi Foundation. (RPi's + You = Raspians)

W. H. Heydt
Posts: 10774
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Corrupted SD cards

Mon Jun 17, 2013 4:21 pm

Probably easier for most people to remember "sudo halt" than "sudo shutdown -h now", though they do the same thing.

A couple of other ideas...

1. If you want to halt the Pi on a recurring basis (say, 8 PM every Friday), set up a cron entry to halt it. That won't actually power it down, but it will do a controlled shutdown. If someone is available to do a physical power shutdown, then there won't be any issues once the cron entry has executed. (To make a cron entry, use "crontab -e". The file contains documentation on how to set up entries.)

2. If you really have to just pull the power, make sure the system is idle (no one logged in and nothing happening that will cause writing to the SD card) for about a minute, then drop the power. That will give the logic on the card time to do any wear leveling activity that might be in progress time to complete and greatly reduce the chance of corruption.

JoeSchmuck
Posts: 14
Joined: Sat Jun 22, 2013 2:28 pm

Re: Corrupted SD cards

Sat Jun 22, 2013 2:54 pm

With all the GPIO ports, can't you just attach a push button to one of them and monitor it for a signal. Then have a little application force the shutdown? That is an idea but a novice may struggle to complete this. I'd just think that this has been done before is all.

I'm doing my research on the Raspberry Pi right now before I buy one, probably this weekend I'll order it, and while doing all this reading I would think the GPIO would be the way to go assuming those pins are not being used for something else. I know that once I do have my device, if I run into corruption then I will work this type of solution assuming it isn't already out there.

EDIT: Actually there are two products out there that turn of the power by using a script and something we shall call "intelligent switch". Search google for "ATX Raspi" for one of the items.

Return to “General discussion”