DYING SD CARD - JSON Backup files out of control, filled disk

I’ve just spent a long time recovering my system after the JSON Backup directory at var/lib/openhab2/jsondb/backup filled up with 140.000 files and then proceeded to fill the log with can’t write to backup file messages. This was despite the settings in JSON Storage being set to 5 Backup Files.
The other settings in there were write delay of 15000 and a maximum write delay of 60000.
My other system currently has a mere 626 files in there which stretch back a few months as it has a lot less that runs auto discovery.
Right now the main system is filling up again with several files per minute, is there an easy way to sort this?

Running on an SD card in a board computer? If so your SD card is failing. You need a new one.

Yep Pi3, is that guaranteed?

Pretty much.

Is it likely the card is corrupt if fsck comes up clean? Can I simply delete the rubbish backup files after restoring onto a new card?
I’m guessing the OS repeatedly told OH the file wasn’t written successfully so it keeps trying?

To answer my own question, I’ve just imaged the old card onto a new Samsung Pro Plus 32GB, running in my normal configuration of 75% unallocated space. After deleting the contents of /var/lib/openhab2/jsondb/backup everything is now working and the folder isn’t filling up again.
Thanks @rlkoshak for your prompt assistance!
For those following on:
The old card (Sandisk Xtreme pro 32GB) lasted around 2 years, and that included running the energy monitoring app EMONCMS on a while. Apart from OpenHAB most of the file system runs in read only mode with logging on a RAM Drive

1 Like