SD card excessive write usage on Raspberry Pi

Hi,

In order to preserve my Raspberry SD card from excessive writes I would like to redirect the Openhab log files and persistence databases to an external USB Key or driver.

Can I and if possible how, change the OpenHab configuration to redirect logs and persistance files to a specific directory.

Thanks Robert

One way is to edit logback.xml and change the paths therein.

Ok, thanks, but this is for the logs only, where can I find the place where the persistance directory database are defined.
Robert

It depends on the persistence service. Some are likely fixed, others like mysql, you can put where you like…

I am currently using rrd4j, and I couldn 't find any refrence where the default directory is defined

rrd has a fixed folder location in the user data folder. You could probably move the whole user data (I think this is probably a setting somewhere - it definitely is in OH2), but you can’t change just the rrd folder with the current codebase.

So the only one l should be able to define in a non default location is currently only mysql?

I don’t know - I’m reasonably sure that others would also allow the database to be set, but I’m not personally knowledgeable in all the others. My guess though is that databases like influx and mongo would also allow this, but I’m not certain.

Maybe others can jump in here and comment - or maybe the wiki might say :wink:

You can “move” the rrd4j folder using symbolic links. Put the folder on your external drive and ln -s that folder to ‘/var/lib/openhab/persistence’.

2 Likes

Good idea, I will try that
Robert