Docs on how to backup openHAB

There are docs for backup strategies. It’s the Amanda docs.

Plus the title is misleading and as such not in line with community guidelines.
I know you don’t mean it that way but anybody unaware to only read the thread title will not know that and I don’t think that clickbaiting is your intention here :wink: Thanks.

Links to external docs/pages/whatever, does not make it an openhab doc…

All openHABian docs (and Amanda being among these) are part of openHAB docs.
That’s why you found them. You even quoted them in your post #1.

Not really… I found a link to Amanda and another link to a doc of how to using it with openhabian.

Se option 4.
First link is to amanda.org. Second link is to openhab on github.
As far as I recall, you´ve said yourself, external services is not part of openhab, and therefore not part of openhab docs.

And that’s where the strategy is documented.
That is not external but is a link to an official => openhab <= repo, part of the openHAB organization. That’s just how docs are technically organized.

That part mainly depends on, how much has been backup´d. And second - How long does it take to restore either partial or full.
An image copy will take longer than a file copy, unless the file copy option copies all files ofcouse.
A image copy usual follow an incremential backup, meaning - Only new and changed files are beeing added to the backup.

I have thought of that myself.
Like you, I know openhab-cli backup dont backup everything. And I do have some files which I have changed manually, just like you, which is not beeing backup´d, (I think).
This is a serious matter the user of openhab-cli has to pay attention to. And I will explain this in the “docs” as well.

I´m not sure I understand what you mean here?

Restoring a backup is the most important part. If it doesnt work the way its suppose to, there is no point in having such a backup procedure.

No, this is how the doc for the external service named Amanda Network Backup is technically organized. You dont see InfluxDB, Grafana etc in openhab docs either.

Openhab docs are placed: https://www.openhab.org/docs/
This is where:
Concepts
Installation
Configuration
Administration
etc
are placed, with relevant submenu´s.
There is no Backup in there, even though it would be highly suitable as a sub-menu of Administration.

This is what this thread is all about, as well as trying to create a doc for backup strategies, which hopefully can be inserted as a sub-menu under Administration.

Openhab-cli is a backup strategy (option).
In my opinion it belong directly in the “missing” backup sub-menu, cause its part of openhab, and not an external service.
Amanda is a backup strategy (option) as well. In my opinion its mentioning belong in the “missing” backup sub-menu as well. But it has to be a link to the doc at github, cause it is an external service and not part of openhab.

I simply cant explain this more clear.

Regarding the subject.
It does not say there is no backup options. It says there is a lack of documentation of backup strategies in openhab docs. And I suggest a discussion regarding this.
If you dont like it, you can change it - You´re a moderator, and I cant do a damn thing about it. Just remember what this thread is all about.

For me this reads like: “I’m doing backups for the sake of backing up.”, which definitely is the wrong approach for me.
Or from an other point of view: “I’ll never need to restore, what i did not backup!” This would solve the whole problem: no backup, no restore needed.
I think you’ll get me. Your last sentence in aboves post tells me so. :wink:

At this stage of discussion I don’t care about, if it takes 20 minutes (i’m shure it never does) or three hours. It will take one of the weekends nights anyway - whatever the plan was.

Most people know what they would have needed to backup when they had been forced to do a restore.
Most of these even never wasted a thought what they are backing up. And what they may need in which situation.
Most of these again become angry, if it has not been in “their” backup, what they would have needed to restore.
After the first pain they may know (but don’t realize and go and make use of this fact). They become angry and maybe call for better tools. As a rule of thumb they don’t care long about this, when the system is up an running again.
Most of most of most (where are we? 81%?) of these boys 'n gals never gave a thought to situations they might need (or want) a backup to be able to recover (their smarthome).

A bit to much words for this simple message i learned in every days work: people don’t think about what they want or what they need. Making them think about this and giving some guidelines and maybe “translation” services can help. Sometimes. If you are stubborn on this.

The “tool” itself or the instructions to use it, is no solution at all for someone who can’t formulate his/her needs.

So: can you explain, for which situation(s) you like to have a backup available to be able to recover your smarthome? And as an experienced user you may describe:

  1. how do you mange to backup what you need
  2. does restore work and do you test it times
    If you can’t describe these topics: no problem. Answering the question is the key from my point of view.

Hopefully that makes my point clearer.

PS: i’ll take a step aside until @mstormi and @Kim_Andersen stop arguing like they do. This feels to much like everydays work to me. I’d like to face an enjoyable discussion here.

No this is how all of the openHABian docs (including that one on Amanda) are organized inside the openHAB organization to allow for split maintenance.
Just in case you aren’t aware: you’re telling that an openHABian maintainer. Funny.

Ok, I adjusted the topic to something neutral now let’s let this rest.

Does it really make any difference? Amanda is an external service, just like InfluxDB, Grafana etc.
How docs are maintained is not really important to the end-user who is suppose to read https://www.openhab.org/docs/ This URL is also the URL you as well as others are pointing the users at.
As an end-user myself I would suspect anything regarding openhab is placed at that URL. Updates, file issues, pr´s etc goes for Github.
Whatever others might have done belongs somewhere else, wether it beeing github, forum post/thread or a external URL. Its out of the scoop for openhab itself.

That seem to be the strategy of openhab docs.

I can live with that.

No, thats because a backup is like an insurance. You buy one, and hope you never going to use it.

But in this particular situation, with a smart home system, controlling your home, your light, your heating, your hvac, your alarm system… Its highly important to be as little down time as possible.
This is where an effective backup system comes in hand.
A system you can restore very fast, to get your home back online. A crashed smarthome does not wait for you to set it all up from scratch, and your family sure doesnt give you any kind of credits either.

So whats really important is:

  1. Have a backup strategy.
  2. Have the needed requirements available, (like exstra hardware/SD cards etc).
  3. Make the backup at the strategy best time, when the system is running flowless.
  4. Have a effective restore option bringing your system back to 3. as fast as possible, in case its needed (ie if it has fatal crashed).

If any of these 4 points are missing, dealing with a fatal crash often will become a true hell.

First I decide from where I want to start. And then decide from there, what I need.
My way:
It takes me aprox 10 minutes to install a fresh copy of openhab.
From there I can restore my backup, which leaves me with some work to do, (like copying manual installed bindings, get InfluxDB and MQTT up running).
If the restoring works, it shouldn´t take more than aprox 1-2 hours, and the system should be up running like nothing happened, except for a short time period in the influx database missing, which I probably cant recover if the system had a major fatal crash.

Regarding Zwave backup - I have none. There are no easy solution on this, as far as I know. This is the chance one might have to live with, when choosing zwave/zigbee which requires an external hub/gateway. It could have been my Philips Hue gateway, Xiaomi gateway as well… Point is, if that once crashes, there is only one option - Start all over. This is one of the reasons why I dont like these hubs. I do use them, but not for important stuff. If they crash I have time to get it sorted.

It all comes down to, how important is your smarthome system and how much down-time you want to risc and accept. But as soon as a user has reach point 1. he has taken the first step in trying to deal with down-time and the risc. Doing nothing, the risc and down-time will be high.
In an ideal world, a users should just push one button to create a backup, and push another button to fully restore everything in a matter of very few seconds, including hardware faults. Unfortunatly this is far from possible.

You have to rely on the restoring procedure do work. If not, there is no point in making backups.
I know my backups and restoring work. I actually make two kinds of backups. One from openhab-cli, and the second is a regulary file copying of all my conf files, (items, things, sitemaps etc) from my Rpi to my PC.These are files I have been working of for almost 3 years… I would have to see they dissapear due to a faulty backup. A second reason is, it takes aprox 10 seconds to copy those files. And I would consider myself as a major idiot, if I didnt spend 10 seconds securing these files, just by copying them.

I would get rather pissed if I trusted a backup and the restoring turned out to not working, ofcouse. But this is a scenario I cant really imagin. If I dont trust it, I would not spend my time on it, and I would look for another solution.

Thanks for your explanations!

Even if i am going to take out insurance, i will look at my requirements first. What are the highest risks? What has to be insured? What is included? What does ist cost / how long does ist take? Do other have experience with …

That brings me back to

F.e. starting from “What do you expect to get broken?” and possibly end up with “How much time are you willing to investigate to find an apropriate solution (which you than might present to others)?”

From my point of view this would be no 1. from your list

I don’t have one for my rpi ATM.

Maybe you like to elaborate on this a bit.

Requirements and needs are always a matter in any case.
If you havnt got any requirements or needs, there are no obvious reason for making any kind of insurances (having a backup strategy) for it. This goes for general matters.

In this particular situation, we´re talking about smarthome system, which (as I said) are suppose to be running 24/7. It means, (I have to make some assumptions for most people), that there is some kind of an need and requirements, unless your run your smarthome system just for fun.

Every kind of strategy got cons and pros. And particular backup strategies can/will often be filled with compromises. wether its about equipments or time, there will probably be compromises.

Every compromise has a consequence.
In order to decide those compromises, the user have to know the consequence.
Not knowing the consequences, the chances are that the user will pick the wrong compromises.

In my world, the best way to find the compromises is by the use of one single question - “What if…” And then use this question in all thinkable situations. Like:
What if my house burns down to the ground? - Well, simple, there is no need to have a backup for my smarthome system, cause there is no longer a house. I could have a backup though, cause my house is probably beeing rebuild. But this backup would then be used to rebuild everything from scratch, and probably no directly useable in the new house, which might be build differently.

A more realistic case could be:
What if my SD card in my Rpi crash? - There are several solution for this. But first you need to decide, if you even want to recreate your system or not. In this case I assume you want to.
So you´ll need to recreate your SD card, maybe even buying a new SD card first. Unfortunatly this crash happened at a time, where it takes a few days to get a new SD card. Can you live with that? If not, then you need to decide how long you want to wait. Ideally you would already have a spare SD card to use, which minimize the down time of your system. If not, your have to wait.
Now you got this spare SD card, you need to decide wether you want to start all over recreating everything, or if you have a backup file, which you can restore fast. Again, this is a matter of down time. If you need to recreate everything from scratch, then down time will rise alot more than having a backup you just need to restore.
These are all quite simple decisions to make. But they´re important to know the consequences and to build your strategy.

Lets take this a bit futher:
What if my Rpi breaks? - This is where the compromises starts rolling in. Equipments is a though one to decide. Ideally you would have a spare parts of everything. But thats often not possible due to the financial situation/echonomic. So this is where a true compromises will appear for most.
If you cant afford a new Rpi, then the consequence is pretty simple - You no longer have a smarthome system.
If you can afford a new Rpi, but need to buy one first, the consequence is more down-time.Can you live with that? If not, then your strategy means you either have to have a spare Rpi ready, or make sure you can get one when the main Rpi breaks. Its just a question of down-time vs needs.

What if my internet connection drops?
Well - Can you live without? If not, there is only one true solution - Get a spare internet connection, and maybe new network equipments which is capable of using redundant internet, (this could be OTA 3G/4G/5G internet).
Maybe you dont know if you can live without. Maybe you have some services running where the need of internet isnt that important. And the rest of the system works just fine without internet. In this case you dont need a spare internet connection. But you´ll have to ask yourself for each services running, can you live without.

This is the way I build my strategy, simply by simply asking myself, “What if…” questions, and knowing the consequences on each answer.
I hope it makes some sense.

There is however one single question which infact isnt important to you, but to the rest of your family in your house… “What about your family if you die?
I´ll not borring you with more writings on this, but just leave you with a small youtube movie, where a person (Jonathan) from SuperhouseTV explains how he deals with it, and why he thinks its important. I do share his opinion, but I have to admit, I have not done this myself, yet.

Go, let’s go one level lower and look at a topic, which is part of recovering your smarthome using openhab on a rpi.

SD broken

  • need new card, which you have available, because you decided to do so
  • need the software system on the card. Good idea is, to have an image copy of your broken SD - when it was still running - handy. So how to prepare such a thing? Easy: create an image of your SD from time to time (to dicide exactly) and store it on a new SD card you may put in a safe place. So now we come to the point, where we need to know exactly how to do this. Let’s assume, we know there is an option to take the SD-Card to copy out of the rpi. we decide: that is not acceptable. So next ist to look at Amanda. This is said to be able to do this. So let’s make a receipe, go cooking and eat our own dogfod (learn from the docs, write commandlines and instructions down, make a back, restore it).

Other cases to look at:

file deleted by mistake
file corrupted
system does start after update any more
… ?

On this level it might be worth to have some examples, i think. This could provide some guidelines for newbies or friends not afin to IT but want to run thier smarthome devices on their own. Is this the direction you are thinking?

My family will just be going to switch the lights off, btw. Not going to blame Alexa. This is, why i keep the old switches and such working as far as possible. :wink:

These cases sure is important as well. And my idea is to giev examples on what to do if such a thing happens.

Thats exactly what I´m thinking. Remember my focus - A backup solution should be as easy as possible. It should not require the plain user to go study something for hours. This is one of the reason why I wont focus on Amanda. Even though I havn´t read the updated documentation, I still believe its way beyond the knowlegde of a new or plain users knowlegde. Amanda is for the advanced users.There is a much easier and faster way to do this, when concentrating on the configuration. Second Amanda is an external service.

$OPENHAB_RUNTIME/bin/backup is build into openhab. Its powerfull and it can be used by all.
My plan is to try convince the maintainer to make use of it, and make it smart - This part of the topic I have not mentioned anything about yet, but here it goes anyway:

By the use of $OPENHAB_RUNTIME/bin/backup and restore, the option to backup and restore the configuration of openhab could be build directly into PaperUI menu, leaving an option for the user to start the backup procedure, download the new created backup zip file to store it locally. And to do the reverse when restoring.

The inspiration came from others systems, like Ubiquiti Unifi Controller. Its so simple that even a total newbie can do it. It requires almost nothing. There is nothing to think about. Things happens automaticly and very fast, simply by a click to a button.

This is what I call a user firendly backup procedure. If the user can get a clean openhab up running, he can backup and restore the system just as well.

There may be a limittations to this, beside the limitations in using $OPENHAB_RUNTIME/bin/backup.
I´m not sure if the parameter --full for including cache and tmp is possible, without stopping openhab service first. But even without cache/tmp, this is a very fast and simple way to get back on track, very fast.

What the user gain is:
He does no longer have to connect through ssh first.
He does not have to think, how to transfer the backup zip file from the system to a local storage.
He does no longer have to think about where to place the backup file when restoring.
He can do this from PaperUI only.

I´m very positive this could be coded very fast by the maintainers, which is why I really cant figure out, why it hasn´t been done already. But lets see if there are any maintainers in here who wish to comment on this idea.

Reading your lines something came to me mind, i didn’t think about up to know.

My wife comes home from a shopping tour (fortunately she does rarely) having bought a small box. Theres an “OpenUp your Smarthome” sticker on it. Plugs in, gets it on the net, searches for things in our appartment and switches the lights on via smartphone.
Some days later, she describes scenes. “Play music, when i come home”, … works perfectly for some weeks.
Somewhat later, music doesn’t play, when she arrives. “He’s dead, Jim”. She brings the device to the dealer and gets a knew one. Then back home … holy shit … the same procedure as …
But there is a knob in the app of her smartphone: “bring back known installation”. Click. Music turns on again.

Looks to me like some marketing experts want to tell me how the world is. We know it is not. Anyway - you seem to be hunting in this direction.

I am not fond of the idea making openhab an other backup monster. But the idea to take what is there and give the user a chance to run something like “openhab-cli backup to a configured destination” (and also restore from!) using the web interface?
I do not think, that it should be a job of openhab to create an SD image. If SD image, why not my harddisk. Or my synology. But simply the parameter choosen to run openhab and anything created for by the user (items, things, whatever). Why not! But i’m not a maintainer nor a developer.

At the end, noone is taught how to develop a backup strategie. But you maybe right: my wife would never think about something wired like that.

Did i get it?

I agree, creating SD images as a backup strategy is not for openhab. This goes for external services.

Maybe not. Or maybe she would, after going back and forth between home and the dealer, a coupple of times :slight_smile:

This is indeed the direction I´m hunting. It will work for most, and it will provide an fast an easy way to get back online, without having struggle with other services.

@mstormi is it possible to write a document that steps you through Amanda for OH backup or is Amanda to generic? If the second case is true then maybe do a poll of what the majority of users have OH running on and write a doc for that system.

@yab if you make changes to other files that openhab-cli does not cover in it’s backup then use the linux commands to make a copy of the file and store it with your openhab-cli backup. There are many sites for helpful commands like this one: https://community.linuxmint.com/tutorial/view/244
Another option is to clone your system when making major changes or every 3-4 months. https://beebom.com/how-clone-raspberry-pi-sd-card-windows-linux-macos/

@Kim_Andersen maybe add the commands needed in your backup doc to make a copy of additional files and also how to change permissions/owners. I agree with @mstormi that there is a cutoff point where you can not provide every detail for every system/user and Amanda does accomplish this. The downside is Amanda is difficult to wrap your head around and most will give up leaving them without a backup.

I don’t think the solution is to provide a bunch of extra links (kinda like I did above, :upside_down_face:) but just add the actual commands needed.

What about a look into the existing doc before asking.
As you know I don’t share Kim’s opinion anyway.

I looked at the doc’s in the past and for a new user it’s a bit much especially when there are warnings like Don’t use unless you understand what these commands do ! That was when I was very new and I found openhab-cli way to simple so I dropped the idea of using Amanda. Maybe I will give it a go with one of my test systems, :thinking: but I think you get (not saying you agree) my point.

1 Like