Migrate OpenHab 2 to another Host

Hi,

i have an OpenHAB installation running on Ubunutu 18.04 LTSR.
No i plan to move the installation to another host.

Is there more to do then Backup and Restore?
https://docs.openhab.org/installation/linux.html#backup-and-restore

I user the following Bindings:

  • Homematic
  • Astro
  • Philips Hue
  • Cloud Connector
  • Telegram

And i configured some rules…

I ask myself for example if i have to reconnect Philips Hue or Cloud Connector.

Thx in advance.

I had openhabian on a RPI2 and moved everything over to a RPI3 using the backup and restore guide with two issues. Issue one was caused by me when I set the IP on the new RPI3 to match the old RPI2. This was solved by fixing the MAC address in router. Issue two was the FireMotD did not install. Fixed using openhabian@openHABianPi:/opt/FireMotD$ sudo ./FireMotD -I -v
Your setup may be slightly different if not using openhabian but should work fine.

1 Like

OK, Thank you. I think i will try.

If you don’t mind my asking, what are you moving openhab to?
I had no issues with RPI2 but I sometimes worried about the microSD card failing. The RPI3 B+ setup is connected to an 120GB SSD and works good with no microSD needed.

I plan to move from my Hyper-V Ubuntu 18.04 installation on ESXi VM.
Because converting the VM is not as easy because Hyper-V is running in non domain mode.

Just concidering my options atm to see if i try with 3rd party converter or just installing new OS and migrating data.

Currently Hyper-V and in Future ESXi runs on INtel NUC Gen7.

I would just install openhab manually then move data using the backup script.

Your openha b paths have to be the same on old and new.

I’m sorry to bring up the old topic again. I have also migrated openHAB several times and would therefore like to add a little something.

With openHABian, I simply copied the SD card and then changed the host name accordingly and also made other minor adjustments to openHAB, which just points to the other host. You save the Zulu Java and openHAB installation. Maybe even a few configurations. I have also created some aliases that I use in the operation, etc. Maybe specific server configuration etc.

With virtual machines, you can theoretically proceed in a similar way and copy a VM. Possibly also create an image that can be reused for new instances. This would also be a standard process. The SD card images can also be retained. Not only as backups, but of course as installation images for new instances.

Otherwise, you can of course set up a system completely from scratch and then copy the necessary data. I leave the installations out of it. It depends on the system (Windows, Ubuntu, Raspbian).

Before each migration, it is generally recommended to create a backup. This is no different with openhab:

This possibility was mentioned, that you then simply play the backup.

sudo openhab-cli backup
...
Success! Backup made in /var/lib/openhab2/backups/openhab2-backup-21_07_05-03_54_49.zip

Restore openHAB then works with:

sudo systemctl stop openhab2.service
openhab-cli restore /var/lib/openhab2/backups
sudo systemctl start openhab2.service
I'll break it down using the example of Ubuntu Linux, how to do it manually:

sudo scp -r <user>@<ip>:/etc/openhab2/ /etc/
sudo scp -r <user>@<ip>:/usr/share/openhab2/addons/ /usr/share/openhab2
sudo scp -r <user>@<ip>:/etc/default/openhab2 /etc/default/openhab2
sudo scp -r <user>@<ip>:/var/lib/openhab2 /var/lib

sudo systemctl stop openhab2.service
sudo rm -rf /var/lib/openhab2/tmp/*
sudo rm -rf /var/lib/openhab2/cache/*
sudo systemctl start openhab2.service
sudo systemctl restart openhab2.service
sudo systemctl restart openhab2.service

I start from the target system. You connect to the system from which you want to transfer the data and copy it over via scp.

Here is the explanation:

  • /etc/openhab2/: User configuration such as sitemaps, items, etc.
  • /usr/share/openhab2/addons/: manually installed add-ons that you did not install via PaperUI. These can be add-ons from GitHub or because you have disabled remote access and want openHAB to work without the internet as much as possible.
  • /etc/default/openhab2: The run configuration. For example, how much memory should be used. Possible adaptations are often necessary for Jython or also because of the Alexa binding.
  • /var/lib/openhab2: For bindings etc. that work via PaperUI, you must also copy this directory. Also so that all things created in PaperUI are available, as these are not stored in /etc/openhab2/.

I recommend clearing the cache and Tmp. Start and sometimes restart, because otherwise the import does not recognise all items, sitemaps, etc. and you then click on a group and the content is not displayed underneath. This is a well-known workaround.

With openHAB 3, it works largely the same. The only difference is that openhab2 changes in the path to openhab.

I found this How To very simple to understand how to scp data from one place to the other. This actually should also help for the migration.

Simply migrate the openhab directory by scp from one system to the other.

Use:

scp [OPTION] [user@]HOST_A:]/directory1 [user@]HOST_B:]directory1