Sd-card corruption?


(Markus Storm) #41

Sorry I have to confirm that :wink:
Yes you can get along without swap (well, paging actually) if you know your workload very well. But that does apply to just very few people and use cases, and certainly it would be bad advice to the average user.
That’s particularly true on a RPi with 1GB RAM and OH process eating ~600MB, not counting OS and helper apps.


(Micael ) #42

Well, 1GB should be plenty, not saying it will work for everyone. But it is very easy to test, over a few days; either it works or it doesn’t. If it does, media wear will be reduced for sure. You might even get some better performance.


(Markus Storm) #43

I agree that media wear will be reduced, that’s why I do it, too . But unlike you I needn’t be afraid of running out of (virtual) memory. But then again I have a NAS.

We’re discussing if and how to include that in openHABian.
Now NO swap for a somewhat unknown extent of use and an unknown level of user knowledge - nope, that’s too risky a thing.
For users to not own a NAS, I’d suggest to add a USB stick and to put swap (and logs and persistence db) there.


(Micael ) #44

I actually do not run OH on a RPi, but on my main server, which runs on a UPS, but at work we produce a lot of embedded linux products running off uSD, which is why I suggested this as a solution in this thread.

I haven’t heard of any filesystem issues since we started to ship them out a couple of years ago. We do, however shut down the machine and sync fs using onboard caps on devices that are writing to the (uSD) disks. We also take care to test uSD carefully every time we change the uSD make/type/models.

Not suggesting anything for openHABian.


(Daniel Malmgren) #45

The best option is to have a swap partition configured but set vm.swappiness very low so it’s not used unless absolutely necessary. Setting vm.swappiness to zero means it’s only used if the OS would otherwise crash.


(Markus Storm) #46

Good idea.
Btw, that behavior changed a little. vm.swappiness = 0 now means NO swapping at all.
What we want can be achieved by setting vm.swappiness = 1 now.
I feel openHAB startup is a little faster now, too. Haven’t done any measurements, but that’s somewhat reasonable to believe in.


(Daniel Malmgren) #47

Ah. Well, in fact mine is set to 1, I thought it meant that when I set it up I felt a very tiny little urge of swapping :smile:


(Elena Gil) #48

If you want to fix the SD card, formatting is a good idea. If you want to recover a corrupt SD card, you can only do it with a data recovery tool.