I do not use Amanda and personally fine the documentation overwhelming and not something I recommend for anyone new to Linux.
I agree that making a back up shouldn’t be difficult or confusing so here’s what I have in my personal notes (if you’re new to OH or Linux then I recommend keeping notes for what works, ). I’m using an RPI 3 b+ and installed OH via the openhabian image but this will work for any Linux distro.
#1 Explanation - (short story, what does it do, and especially, what it do not do).
This will backup /etc/openhab2/
and /var/lib/openhab2/
This way, the information about installed addons is backuped, but not the addons itself, so when installing openhab2 new, the actual version of the bindings will be installed.
The only things to backup in addition, are the manually installed addons.
#2 Requirement - (containing what’s required to be able to do openhab-cli backup… Terminal connect, backup storage etc)
Be able to type access the command line and use sudo openhab-cli backup. Most use Putty and SSH connection for command line access as this works on most any OS. Install Putty, enter your servers IP address (this would be your running version of OH), check the default port is 22 then click open. This should take you to a screen where the user name and password is entered. If all goes well you should be at the command line like the image below.
#3 How to backup - (command(s) which will lead to the actual success of the backup. Any special requirements need to get posted as well
Use sudo openhab-cli backup or sudo openhab-cli backup-full I have not tried using just backup but know that backup-full works fine. After the backup is complete it will tell you the location of the zipped file. For Linux users, this would be var/lib/openhab2/backups
. From here you will need to move the zipped file to your PC, USB, or another safe place. I use FileZilla for moving the zipped file to my PC and it works well.
Note: If installing to a new image you must first run openhab-cli backup on new install so a backup directory gets created, then delete the new system backup. If you have file permission issues
before transferring then use sudo chmod a+rw backups. To change back permissions sudo chmod a-rw backups. You can also use openhabian-config to fix the permissions if this is installed on your setup.
#4 How to restore - (command(s) which will lead to the actual success of the restore. Any special requirements needs to get posted as well.
Place the backup zip file into the backups folder then:
sudo systemctl stop openhab2
openhab-cli restore /path/to/zipped/backup (var/lib/openhab2/backups)
sudo systemctl start openhab2
#5 Q&A - (optional components backup, like Grafana, InfluxDB (other persistence modules), how to automatize backup procedure and stuff like that.
I do it manually but adding this to openhab-cli backup would be ideal.
As mentioned above these steps are for Linux users but it would be nice to have a complete guide that included steps and file locations (including steps for permissions or other snags one may encounter) for Windows, Docker, Mac, etc…
I hope this bit of info helps and thanks @Kim_Andersen for taking the time to put this together. Hopefully others in the community will add to this and include info for other OS’s.