Apparent SD Card corruption after short up time

I have a Raspberry Pi 3+ Running OpenHAB and Zigbee2MQTT.

Last month I started having some issues, one of these was I would install a binding but it would uninstall if I rebooted I was told that this was due to a write issue on my SD Card.

I bought a new SanDisk Extreme 32 GB microSDHC Memory Card from Amazon and set everything up from scratch.

Everything was working fine but over the past week I have noticed some of my previous issues returning. As a test I just installed the MySQL persistence binding through PaperUI, confirmed it was listed in my addons.cfg file and rebooted the Pi. Unfortunately the binding did not survive a restart.

What could cause my card to show these errors after just over a month of running and how can I avoid it happening again if I replace the card?

Thanks.

Use openHABian and its ZRAM feature.

How are you restarting? Nicely or just pulling the power?

I am using Zram.

I always use Putty and sudo shutdown or sudo reboot. I also wait for the LED to stop flashing before removing power. That being said, I have not rebooted the Pi since getting everything installed and running properly last month.

A side note, I also checked what temperature the Pi was reporting and it is around 51-58 degrees. From a quick google this seems to be a reasonable temp as the Pi should be fine up to around 80 degrees.

I’m just trying to eliminate other potential sources of file system corruption.

No problem.

I should have added that to my original post.

I don’t know a great deal about Pi’s but I have seen some tutorials that show it is possible with the right configuration to boot the Pi 3+ via USB. I do happen to have a couple of ole Kingston 60GB SSD’s. Is this something that may be worthwhile?

Alternatively would this be time to consider upgrading to a Pi 4?

Thanks for your help.

The best solution is the one offered by Markus. Anything else will be a lot more work on your part. NOTE: if you do want to run with an external HDD or SDD, openHABian also has built into it tools to move from the SD card to that as well.

Would installing OpenHap onto the latest version of Raspberry Pi OS Buster, following guides on here, rather than just using Openhabian cause this problem?

I did it this way as I was trying to increase my knowledge of the Pi OS.

If the problem is in fact caused by too many writes to the SD card, using openHABian with the ZRAM option will indeed address the original problem. If not than we don’t know what the cause was so can’t say,

When I installed OpenHAB I did check the ‘Use Zram’ option.

Is there a difference between the Openhabian image with Zram and selecting use Zram when installing OpenHab?

There is no option to use Zram when installing openHAB. If you install just openHAB (e.g. sudo apt-get install openhab2) all you get is openHAB. Period. Nothing else.

If what you are really trying to ask is whether there is a difference in how zram works between using the SD card image or configuring it through openhabian-config, I don’t think so. It should end up the same.

The guide I followed had me clone OpenHab from Github and install using the “Manual/Fresh Install” option in openhabian-config.

This gave a list of option on what else to install like Zulu and there was an option “Use ZRAM” that I checked.

Regardless, it sounds like my best option is to wipe the card and start afresh with the Openhabian image, I do have another Pi 3+ that I use on my 3D printer so I will swap them over as well to remove any possible hardware issues.

Thanks for your help.

In that case, no, the guide had you clone openHABian from GitHub. openHABian is not openHAB. openHABian is a set of scripts that install openHAB and a bunch of other related programs and configures the operating system (e.g. zram) in a known and consistent way.

openHAB is a Java program that integrates with hundreds of different home automation technologies.

It really is important to understand the distinction. openHABian installs openHAB (among other things), it is not openHAB.

Other possible causes can be.

Counterfeit uSD card
Power supply not able to provide enough power.
Just unlucky and got a bad card.

Lastly how do you know it is corruption? Just because something failed to reboot does not rule out a buggy update changed something that caused an issue.

Hi Matt.

I have considered the possibility of a counterfeit card or just a faulty one. I will double check my power supply, Pretty sure I have another suitable supply so will change that also.

Last time when I explained that I could install a binding, it would show in the addons.config file, but after a reboot the binding was gone rikoshak explained that something was preventing the config from saving and could be signs of card failure.

Does anything on the Pi auto update as I haven’t done a manual update of anything?

I am planning on setting up OpenHAB afresh using the Openhabian image file on a different Pi just in case there is something on wrong on the Pi itself that could be causing my issue.

Thanks.