INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Protecting the SD card against corruption  (Read 2014 times)

phillil

  • Junior Woodchuck
  • **
  • Posts: 62
Protecting the SD card against corruption
« on: December 01, 2015, 05:20:55 pm »

Having recently got JR up and running on my new RPi2, I was thinking about other uses (such as XBMC etc) and hence looking at options for a new SD card.

I then seem to notice a lot of threads about SD card corruption, and a LOT of cases where SD card only last a few months or even weeks before they become corrupt and have to be thrown away.

It appears this is largely down to interrupting the write process (power loss, overclocking, insufficient power supply) and generally just a  lot of use.

To mitigate this, it seems the advice is to use decent power supplies, never unplug without shutting down, minimise reboots and try to minimise the number of writes.

I have also read that making the boot folder read only thus protecting the boot process should other parts of the SD card corrupt....

And in terms of minimising writes, re-mounting the logging folders into RAM and disabling the swap-file can help.

move logs to RAM in fstab;
none /var/run tmpfs size=1M,noatime 0 0
none /var/log tmpfs size=1M,noatime 0 0

and protect boot
/dev/mmcblk0p1 /boot vfat ro,noatime 0 2

So my question is, does anyone have experience with corrupt SD cards?? and if so what's the advice on preventing corruption, and process for backing up the SC card

Or, are the various reports of SD corruption merely scaremongering?
Logged

millst

  • Galactic Citizen
  • ****
  • Posts: 256
Re: Protecting the SD card against corruption
« Reply #1 on: December 02, 2015, 11:58:05 am »

I think it's mostly old information. It happened more regularly in the early days of the Pi's release. The OS distributions have been improved over time and, while it can still happen in rare cases, I wouldn't worry too much.  

I definitely wouldn't spend time re-configuring the OS based on some random post. Especially so if you don't truly understand what you're changing. You are just as likely to cause problems down the line. Moving the log files to RAM reduces writes, but now they aren't preserved across reboots. That makes troubleshooting more difficult. Disabling swap could reduce writes, but at the expense of instability/panic if you load too many apps that consume all memory.

Flash memory has a finite lifespan as far as writes go. It's just a matter of time before it stops working, but the fear is mostly over-hyped. I have had 3-4 different Pis over years. I haven't replaced the flash in any of them. I managed to corrupt it once, but I was yanking power during boot and it still booted okay. I just started getting a warning on boot.

The best advice I have is that when you get everything configured, make a full backup (use whatever disk image utility you used to burn the OS image to the flash). Periodically back up files that change regularly, too. Then, when something goes wrong, you will be prepared and can restore. If you have a UPS nearby, take advantage, but I wouldn't go out of the way to buy one. The good power supply, not yanking power, quality SD recommendations are good advice.

-tm
Logged
Pages: [1]   Go Up