Thoughts on failing SD card

Tags: #<Tag:0x00007f616dc57d28> #<Tag:0x00007f616dc57c10>

This is just sharing of thoughts, no question for help. yet your thoughts on the matter are appreciated

Recently, I encountered many issues with OpenHAB that most likely were caused by a faulty SDcard as @rlkoshak was suggesting.

That kinda got me baffled. It was a new Kingston 16Gb SD card, bought at a reputable store and maybe 2-3 mo old.

Yet, putting everything on a new card seemed to solve all the issues I had.
remarkably, before I had encountered clear ‘problems’ I had noticed that no matter what I did, I could not show weather data anymore, whereas when everything was put on a new SD card, the wwetherdata immediately showed up again. Was the binding previously maybe situated on a faulty SD card localisation?

Anyway… what can cause an SD card to go faulty after 3 months? I made sure I never cut the power, but always properly shut down my raspi, so that cant be it. Is it the many card operations?
The only really intensive card operations I can think of are the logfile writes. Perhaps there is a way to stop those.

Everything on a 16 Gb Samsung card now. We’ll see. I have had problems with Samsung cards before as well

Check out: http://elinux.org/RPi_SD_cards
It seems that some models of Kingston (16G Class 10) have issues.

In general I would make sure that the Power Supply is a good quality one. I never had issues with my rPi3 and the SD Card.
I use the official power supply (connected to the output of a UPS) and the rPi3 runs very smoothly.

This resource is very useful: http://elinux.org/R-Pi_Troubleshooting

1 Like

Thanks, I got an SDC10G2./16GB and that one is reported as OK in your (useful) link.
Powersupply seems OK, supposed to be able to give 2Amps. not sure if that is the ‘official’ one, got it together with the RPi3 as a package deal.
Thanks for yr links

1 Like

I would consider moving root to a flash drive. I feel they have better lifespans and should be a little faster. I also would clone my card/flashdrive after i got it working the way i want and after any changes. That means 2 clones, 1 (#1) working the way i want and one (#2 ) after changes. If the changes work the way you want, then it becomes the (#1) clone and you use the original copy for the next change.

Thanks. One could put the root on a flashdrive, but I like the ease of Openhabian that just puts everything in the right place for me.
Indeed I keep a full diskimage to restore, which is what I did in this case. At worst my items file might be a bit behind, but I make a regular backup of that file so restoring is easy peasy

Openhabian habian-config gives you the option to move root to flashdrive some where in the menu.

Then I certainly will need to have a look at that, thanks :wink:

Manufacturing problems and/or lots of file writes.

Writes are what wear out an SD card over time. Loggers and persistence are going to be the biggest sources of writes on the SD card.

If you are OK with losing your logs on a restart you can put /var/log on a tmpfs file system which will take the writes off of the SD card and into RAM.

The more common approach is to move the Pi to using an external HDD or SSD (with a Pi 3 you can even boot off the external drive).

Another common approach is to religiously take snapshots of your cards and be ready to replace a failing one with a backup at a moment’s notice.

The bigger the SD card, the longer it takes to wear it out, but all SD cards (and thumb drives) will eventually wear out with repeated writes.

My opinion on the matter: Concentrate on a backup strategy.

See: openHABian: Problem after upgrade

Thanks Rik, yes I agree, I just had not expected it to happen that fast, hence I spend too long trying to find ’ the problem’
Might be a good idea to use a tempfs and maybe I should go to HDD… will miss the easy openhabian setup then :slight_smile:
I indeed had been making snapshots. Itemsfile and some rules not entirely up to date but i take file backups of those nearly every day

The openHABian scripts that let you put the root on a USB drive should also work with an external HDD/SDD.

Thanks Thom and yes I agree. Fortunately had decent back ups.
318 years??..I would definitely sign for that

great. learn something new every day

To rely upon ‘good’ SD cards is lottery. As @ThomDietrich states, focus on a backup strategy.
openHABian now also includes a backup system that allows for backup/restore of selected files as well of raw devices based (complete SD card), useful for creating card clones.

indeed, I keep discimages plus recent config files updates, exactly for situations like this. It just took a bit before I realised what the problem was… once i realised it was a piece of cake

Btw. I’ve just added the command to collect write stats to the posting linked above. In case you want to do some measurements yourself :wink:

Great, Thanks. Will check it out