Backup fails - Structure needs cleaning

Hi all
I need your help. My OH 3 is running on a Pi and when I try to create a backup (sudo openhab-cli backup) I get the error “structure needs cleaning”
I identify some files in var/lib/openhab/jsondb/backup which have no owner and no group

For example
-??? ? ? ? ? ? 1688932548909–org.openhab.core.items.Item.json
-??? ? ? ? ? ? 1688932563894–org.openhab.core.items.Item.json
-??? ? ? ? ? ? 1688932595129–org.openhab.core.items.Item.json
-??? ? ? ? ? ? 1688932803249–uicomponents_ui_page.json

same in /tmp/openhab/backup/userdata
d??? ? ? ? ? ? config

How can I solve this problem.

Because after a reboot any changes to things, items or rules are lost

Does anybody have a hint what to do?

BR Uwe

Hmmm. That’s a pretty unhealthy file system. Are you running openHABian with zram (default settings enables zram)?

This is an OS problem, not an OH problem. Often these sorts of problems can be fixed using fsck but want exactly the command is is going to depend a lot on how your system is configured.

First create a disk image so you for sure don’t lose any data.

Then if openHABian and zram I’d try a restart and hope for the best. If not, we’ll need to know what file system is being used and run the correct fsck command to detect and hopefully repair errors.

You would normally only see stuff like this if the machine suddenly lost power without shutting down nicely, or the SD card might be wearing out.

Hi Rich
I did not modify the openhab System and at the moment I don’t know the brand of the SD Card.
But I setup the raspbian with the image for the RPi from the OH Website. The System here is running for a about half a year.

Let me create a image with WIN32 Disk-Imager
Hope you can give me the command for the fsck

What I found in the deep of the internet is

1. sudo touch /forcefsck 
2. sudo reboot

and

sudo shutdown -Fr now

I asume the the last one is that what you mean

BR Uwe

If “the image for the RPi from the OH website” means openHABian, than you are likely running ZRAM. If that’s the case it gets complicated.

Doesn’t matter. Something got corrupted. This can happen without you touching the system, particularly if the machine loses power without getting a chance to shutdown normally.

Note the docs: openHABian | openHAB and the cautions there.

That should work, but like I said, if zram is involved it gets more complicated.

1 Like

This Commando helps, the permissions are back. But as before, all changes are gone.
I will replace the SD-Card. It is a NoName Card. My fault

Thanks for your help, Rich

JSONDB files (or any config files in fact) aren’t on zram, for obvious reasons.

Read the docs again, get an “Endurance” card and best a UPS, too

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.