Move OH4 from RPi to Macbook

Hi everyone, I would like to ask for support if possible.
I have been using OH for a few years, today the version in use is 4.3.0.M4 on Raspberry Pi 4 Model B Rev 1.4.
I would like to ask if it is possible to copy/move the entire installation, including the persistence archives, on a new installation made on an old MacBook Pro with Intel i5 8GB 2.6GHz, which works and which I have just reset from scratch.
Is it enough to move/copy some files folders? If so, which ones exactly? and with which paths?
Is it enough restore the last backup from RPi?

I am not a computer scientist, I usually make do with the resources of this community.
Thanks for the support.

Should be straight forward.

  • Make a backup (sudo openhab-cli backup full) full is to get internal persistece backuped as well (this is mapdb and rrd4j)
  • copy the resulting zip file to your MacBook Pro
  • try a restore (openhab-cli restore <filename>)
  • set correct ownership (sudo openhab-cli reset-ownership)

If this doesn’t work, you also can extract the data from the zip manually

Hi, thanks for the reply.
I prepared the mac with a fresh installation of OH4,
it is set to start at startup and so far everything is ok.
With the RPi I was used to do the configuration via terminal with openhab-config,
but on mac how do I do it? I managed to access the CONSOLE,
but it is not the same thing … correct?
thanks

There is no openHAB-config command, you surely meant openHABian-config, which is not available on MAC.

Ok, thanks, it’s clear,
reading the OH documentation I understood that it was like this,
but not being a programmer maybe I’m doing something wrong …
The question then is: on the mac how do I perform the “restore from backup” operation
that is available in openHABian-config?
thanks.

For completeness I add that all the configurations in openHabian I have always done only by working with text files (items, things, rules…) and I want to continue to do so also on this new installation… for me it is much more convenient…

Checkout the openHAB-cli command, which dors the backup and restore.
openHABian just issues this command….

1 Like

sorry but I don’t understand …
I’m at his point :


what is the command to use at this point?
I have the last .zip backup available on my desktop
thanks

This is the openHAB Karaf console, not the “normal” terminal.
Open a “normal” terminal and type openhab-cli backup.

ok thanks for the answer
I had the doubt of having stumbled upon this thing again,
I still haven’t understood the difference between the two,
I still have to study the documentation well
thanks

It is quite simple.

ssh „IP of your openHAB server“

will open a shell on your server, giving access to the OS.
From there you can access openHABs Karaf shell by running

openhab-cli console

This is an application shell, giving access to openHAB specific command.
openHAB-cli with all its commands is available only on an OS shell, if openHAB was installed as package…

1 Like

Hi, I’m really sorry but I don’t understand how to proceed.
I’m on my macbook, and OH is started by running the “start.sh” file, after which a Terminal window opens, which is the one indicated above.
And if I understood correctly it is the Karaf COnsole.
I opened another Terminal window and entered the command “ssh -p 8101 openhab@localhost”, and the result is the same, that is, the same screen…
So the question is: on a new Terminal window, what is the command to access what is indicated above, that is, the “normal terminal”?
Forgive my ignorance on the subject …
thanks

You first have to make a backup on your raspberry, using openhab-cli backup command.
copy your backup to your Mac, open a terminal and use the following :

cd $OPENHAB_HOME
./runtime/bin/restore /opt/backups/myconfig.zip  ## Restores the openHAB config from the specified zipfile
./runtime/bin/restore --help                     ## Brings up the help information

ok I do it

The results is :
openhab> cd $OPENHAB_HOME
cd: java.io.IOException: no such file or directory: null

Are you kidding me ???
$OPENHAB_HOME is a variable for your openHAB installation path on your MAC.
I could not know this, therefore the variable…

EDIT: And to be precise, an plain terminal, not the openHAB terminal !!!

No offense, but if you’re lacking fundamental understanding on how to use an OS and do stuff on a terminal, perhaps it’s better to learn this, before you move your smarthome to another hardware.
openHABian does a tremendous job to “hide” all those pesky tasks and stuff from the user. If you’re switching away from that you’ll basically have to learn how to deal with the tech “under the hood” and try to migrate/setup your openHAB on the same time.

Question is, why do you want to move to a macbook in the first place? is there a special reason for this? If OH4 is already running fine on your Pi I wouldn’t change the hardware without a good reason! :wink:

Perhaps we can help you find a solution, where you don’t have to learn all that system administrator stuff and achieve your goal?

Hi, thank you, I don’t get offended, on the contrary,
I am aware of being in the absence of knowledge …
My RPI works quite well, but sometimes we restart
and above all often when he asks me to update then he blocks
because he tells me that there is no space on the SD card.
I am terrified from losing everything
so I simply wanted to copy everything in bulk on this old Mac t
hat I no longer use and have a hardware for sure more performed and reliable for the next few years …
On Openhabian I am clear to me access to Cosole and from the Tertinal, but here on the Mac I do not understand how to connect to the “normal” terminal alone to give the backup/recovery commands … do I have to change a door? For example type “ssh -p 22 openhab@localhost” ?? Thanks for the support and scuate, if I can’t abandon and leave everything as it is …

Where do you type this ?
In a terminal…
Instead of typing the quoted command, type what I wrote….

ok, break it up:

  1. random restarts
  2. update problems
  3. no space on SD card
  4. losing everything

just having an old macbook lying around doesn’t mean it will solve all your above problems! :wink:

if you’d like to stay on a pi (which btw works for a vast majority of openHAB users perfectly well):

1. random restarts
We’d have to solve this after the other problems. My guess is, it’ll stop, if there’s enough space on your Pi’s SD card. Sounds like the card is just full.

2. update problems
Blocking updates seem also to have the cause in running out of disk space on your Pi’s SD card

3. no space on SD card
now - THAT seem to be the real cause of all your problems. So I’d say, we solve that and you give the setup another try?

  1. buy a “good” SD Card. I have good experiences with “Silicon Power Micro-SD card” (on german amazon: Silicon Power Micro-SD-Karte mit Adapter, 32 GB, 5er-Pack: Amazon.de: Computer & Zubehör), should be available everywhere I guess. 32GB should suffice. My guess is, you’re running on 8GB?
  2. use the “raw copy SD” option on openhabian-config (menu 54: openHABian | openHAB)
    use a USB-card reader in your Pi and use this menu. This will result in a exact copy of your current SD card.
  3. Swap the SD cards and boot from the new one
  4. Once your openHABian is on, run sudo raspi-config (similar to openhabian-config) and run “Advanced Options” - “A1 expand filesystem” => then the full size of the SD card is used

now you should have your openHAB-instance running on a new (and bigger) SD card.

4. losing everything
now, if everything is running you can spend some time on “backup”. easiest would be to do “manual backups” regularly within menu 50 on openhabian-config.
most popular options are:

  • SD mirorring: your internal SD card will be mirrored to an external SD card (just like in a raw copy, you did earlier, but automatically). So, if you experience trouble on your boot SD card you can pull out the mirrored one and just be ready in a sec.
  • Amanda System Backup: needs some more configuration an a NAS to save the Amanda backups to. (How to backup your openHABian server using Amanda | openHAB)
  • a few other “home made” solutions… just have a look here in the forum.

I think, it would be easier to stay in your current setup with the Pi. you could always learn more about the terminal wit MacOs. (disclaimer: I don’t use a Mac, but this sounds like a decent course):

1 Like