Corrupted SD Card

Occasionally my PI corrupts (it runs 24/7) its SD card and needs restoring from a backup image.

Is it likely to be more stable if I use this method

formatting link

to run it from a USB stick or a small USB hard drive (of the two which would be better)

Thanks

Reply to
Star Ship Repair Guy
Loading thread data ...

What happens before that? Does it crash, is the power cycled without shutdown, or another noteworthy event?

I have a Raspberry Pi running 24/7 for almost 3 years now, and it has never corrupted its SD card.

Reply to
Rob

My Pi runs for nearly three years, too. Its first SD card got corrupted again and again, sometime once a month, sometimes even more often. But, I found out that the card itself had a data cell problem from the beginning. After a change with a card of the same type these problems never occured anymore. So this can be a reason, too.

Cheers B. Alabay

--
http://www.thetrial.eu/ 
???????????????
Reply to
Ba?ar Alabay

USB HDD no question about it. IME USB sticks can suffer the same sort of corruption as SD

fruit

Reply to
fruit

yes, it certainly can be a problem with the specific card or the general quality of the type of card.

also note that the sticker on the card is no real way of identification, because cards are being made with any sticker by our far-east friends...

(e.g. with Transcend or other A-brand marking on a cheap card, or with

32GB capacity while it really is only 8GB, pre-written 32GB partition table on it as well)
Reply to
Rob

I have a client who uses RPis for industrial displays. They ended up rolling their own Linux distro to avoid SD card corruption. They now run entirely from RAM.

These clients do not pretend to be clever or to know everything. They just did what was needed to solve their problem.

Stephen

--
Stephen Pelc, stephenXXX@mpeforth.com 
MicroProcessor Engineering Ltd - More Real, Less Time 
133 Hill Lane, Southampton SO15 5AF, England 
tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691 
web: http://www.mpeforth.com - free VFX Forth downloads
Reply to
Stephen Pelc

The actual problem will depend on the scenario of failure, which has not yet become clear in this thread.

In my case the Rpi is on reliable power and the failure scenario would be: bugs, crashes, bad SD card, etc. I have not seen these.

In the case of industrial displays, they probably suffer from random powerdowns without proper shutdown. In that case (and the use permitting), mounting the filesystem R/O and putting all dynamic data in RAM is certainly the best solution.

Reply to
Rob

Does the Pi offen write much data to the card?

Reply to
Stefan Enzinger

My experience was frequent corruption of SD cards with the 1st gen Pi, but after adding a fast USB flash drive and configuring /boot/cmdline.txt to boot from it instead of the SD card, I've had no corruption problems going on three years now.

Reply to
John Smith

Well that would depend what your are doing with it.

---druck

Reply to
druck

That's why I asked the OP what he is doing with it. Much file IO might corrupt the Card faster. Especially on power failur, but wear-leveling might have troubles too on some cards.

Reply to
Stefan Enzinger

...plus what packages you've installed: some, e.g. the Apache web server and almost any mail server generate quite large logs when run with default settings on a normal desktop system.

However, the default logging levels used by Raspbian are set to ignore a lot more log messages than my Fedora systems, e.g. /var/log/messages only contains the stuff shown by dmesg - stuff logged by the kernel while its booting.

--
martin@   | Martin Gregorie 
gregorie. | Essex, UK 
org       |
Reply to
Martin Gregorie

Something like ?

33 3 * * 0 ionice -c 3 fstrim -v /

in a crontab could help on some (good) SD cards.

B. Alabay

--
http://www.thetrial.eu/ 
???????????????
Reply to
Ba?ar Alabay

I have several Pi's running continuously for years. They continously log data to the card, not a large volume, but typically every 10 seconds with flushed writeback. Somewhat to my surprise, I've never had any major corruption, but I do try to buy good quality cards. The only thing I see is that after an unexpected power cut, the logfile has occasionally ended with a number of nulls, which were not written by the app, and this is probably data which the SD card accepted but didn't get into flash memory before the power to it was lost.

The Pi 1 which used full-size SD cards did suffer from poor contacts with the card in a few cases, although none of mine were impacted in this way. I haven't heard of this since the switch to microSD cards.

--
Andrew Gabriel 
[email address is not usable -- followup in the newsgroup]
Reply to
Andrew Gabriel

Whichever is the newest Raspberry Pi I've been using as my home ssh gateway, cloud and version control server (data stored externally on a NAS), usually chews through a card in 12-18 months. I've looked at only logging to RAM. but not come up with a solution I'm happy with yet.

The last card to go was a Samsung Evo branded 16GB, rated at class 10. It's failure mode was to go read only when certain parts were accessed, which at least meant data wasn't lost. I got a Samsung class 6 to replace it to see if that offered better random I/O performance, testing showed there wasn't much difference as the Samsung had good 4K reads/writes anyway. However there was something wrong with the card as it wouldn't boot after the fs was expanded (could be an undersized fake).

I got a Class 10 SanDisk Ultra as an immediate replacement, stonking peak performance as expect, giving 75MB/s read, but poor 12MB/s writes, and the same story for random I/O with reads good, but writes poor. For the new Pi3 I've picked up a Class 4 SanDisk which as swapped read performance for write, peaking at 45MB/s read but with 42MB/s write, and random 4K writes are similarly improved. With the same image as on the class 10, the class 4 booted in 40 rather than 60 seconds, and a full dist-upgrade took under half the time (8 rather than 17 minutes) - so well worth going for the class 4.

The big question is how gracefully it will die next year, or if by then I will have changed to mounting root on a USB stick or even a small SSD.

---druck

Reply to
druck

I thought everyone would check new cards for this before using them. I'm disorganised and a bit too casual about most computer/network admin stuff, but I do manage to check the integrity of new SD cards.

Reply to
Rob Morley

Indeed - I use h2testw with all new blank SD cards I purchase (mostly for camera use):

formatting link

I must confess to /not/ checking the cards I buy with NOOBS ready installed which is remiss of me. Yes, I know it's easy to make such cards oneself, but if they come as part of a bundle it saves a little time and bother. OTOH if the OS is out of date, you can spend a lot of time updating it!

--
Cheers, 
David 
Web: http://www.satsignal.eu
Reply to
David Taylor

The SD Formatter does that, though it lasts some time. In the Pi instructions, there is a recommendation to use the formatter and run the full process.

--

-TV
Reply to
Tauno Voipio

It reads the whole card after it's been formatted, and can tell that it hasn't wrapped around?

Reply to
Rob Morley

I suppose he meant the overwrite format option. (I have no idea if or how the SD Formatter verifies this.)

Reply to
A. Dumas

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.