Rehost from Linux to Openhabian?

  • Platform information:
    • Hardware: Intel CPU => RPi 3B
    • OS: Ubuntu 16.04 => Openhabian
    • Java Runtime Environment:
    • openHAB version: 2.3.0 to 2.3.1
  • Issue of the topic:

I’d like to easily rehost from my linux platform to openhabian to retain continuity of quite a bit of data I’ve collected over several months.

Is it plausible to rehost my OH2 system from my linux platform to Openhabian by stopping OH2, moving over the current Gen5 Zstick and copying the following files to their normal locations (unless otherwise noted);

  • JSON file
  • everything under /etc/openhab2/ such as rules, things, items, etc
  • persistence (relocated to USB flash drive)
  • logs (relocated to USB flash drive)
  • moving SWAP to the USB flash drive

The last three lines come from a post by @mstormi enhanced by @rlkoshak about reducing SD card failures

After the above move I would simply start Openhabian.

Is this approach unrealistic?

No. I did exactly that some time ago. But i would suggest to add a 2,5" HDD with an USB cable.

1 Like

Thanks Joachim. Why a HDD instead of a USB flash drive?

I would use the backup and restore scripts that OH comes with (it’s in the bin folder). Run the backup. Copy the resultant tar file to same location on the new host. Then run restore. That should capture everything in a fool proof manner.

If you really want to do it yourself, I would grab everything under /etc/openhab2 and /var/lib/openhab2 except for the cache and tmp folders. That should capture everything.

And to elaborate on job’s response. A USB thumb drive is also just flash memory. Moving the logs, persistence, and swap to a USB thumb drive may save your SD card but it will wear out the thumb drive. You haven’t solved the problem, only moved it.

HDDs and SDDs do not have the same wear out issues (despite being flash, SDDs have room to add additional technology to address some of the limitations of SD cards).

And before Marcus chimes in, I’ll say what he will say. You should spend your first efforts on a backup and restore strategy. You will need one anyway and once you have a solid backup and restore process SD card corruptions and the like aren’t that big of a deal anymore.


Thanks @rlkoshak , the backup is very simple. I’m assuming the influxdb backup would happen at the same time, and I would restore the influxdb first, then restore OH2, then start OH2.

The OH backup and restore only handles OH. InfluxDB is it’s own server and stores and manages its configuration and data completely separately from OH. To migrate InfluxDB you will need to look at their docs for how to best do that. It will probably be as easy as grabbing /etc/influxdb and /var/lib/influxdb, but I can’t say that for sure.

On a similar note, Mosquitto, Grafana, and any other third party application you may be running will need to be backed up and migrated separately.


Get an SSD, less moving parts, less power requirements. Make sure your Pi’s power supply is sufficient if it has to power the disk via USB, too.

:wink: Check out the Amanda README. Quite some generic thoughts on backup in general in there, too.