SD-card of OpebHab server died - how to recover important files?


seems that the SD card with my OH installation @ openhabian on a RPi died - after 9 month since first run…

So first I tried sector recovery with hddregenerator

but there are so many corrupt sectors this didn’t work.

And Easus data recovery neither

My question:
how can I backup the important files like the rules? If I insert the SD card into my windows machine I only see one partition

are there any other important files so I can do a reinstall easier?

Did you try a extfs tool on windows? (see:

No I didn’t because I’m not familiar with linux and didn’t know that Windows can’t see linux partitions.

Thanks a lot for this information, I will try this later at home.

I had success with “Diskinternals Linux Reader” and copied all the files form the SD card to my windows machine.

So which are the important config files?

  • habpanel config
  • settings of the used devices (z-wave and wifi)
  • network settings
  • general OH settings

I’d like to test these files somehow if they are corrupted and then take them for a fresh 2.2.0 snapshot.


& /etc/openhab2/*

Of the rPi? you don’t really need them since you will reconfigure the new host

I general, check the files within the $OPENHAB_CONF folder (/etc/openhab2/*) for data corruption
$OPENHAB_USERDATA folder (/var/lib/openhab2/*) is also important (mostly the jsondb)

Thanks for your fast reply.

But there is no such folder /var/lib/openhab2/jsondb/
and no /var/lib/openhab2/config/

I don’t know the exact OH version, but some “stable” OH2 beta, no snapshot. Maybe the folder structure is different at this older version - or these folders coudn’t recovered by Linux reader

OK, other way round:

which files should I reuse to get a fresh OH installation working?

My dead OH was version 2 Beta 3

There is some useful info here:

In general:

  • All your config files in $OPENHAB_CONF (Linux apt: /etc/openhab2/)
  • Most of the files & folders in $OPENHAB_USERDATA (Linux apt: /var/lib/openhab2/)
    • All subfolders without tmp & cache
  • Optionally (if you are using manually deployed addons): $OPENHAB_RUNTIME/addons (Linux apt: /usr/share/openhab2/addons/) (only the contents of your addons folder…e.g. a *.jar file)

(1) Backup the above from the older OH2Beta3,
(2) Deploy a clean openHAB 2.1 Stable Release in your system,
(3) Restore the contents of these 2 folders (CONF & USERDATA)

Thanks you very much,
I will try / do so and then setup a backup strategy to avoid a further mistake like this.