Docker backup does it require a stop of openHAB prior?

Hi,
I am using openHAB 4.2.2 as a Docker container.

I am willing to have periodic backups and based on multiple threads such as that one: Backup of JSONDB - Docker

seems that I can simply copy the mounted dirs and or zip them.

My question is: Does it require OH to be stopped prior? I am asking regarding the multiple persistence such as jsondb etc that are not managed out of the docker image.

Any recommendation around that?

Thank you

It depends on a lot of details. OH pretty much only writes to it’s configs (JSONDB, userdata/config, useradta/etc) when you actively make a change. Make sure you are not editing the OH config while taking the backup and there will be no problem.

However the embedded databases are going to be written to as often as your Items update/change and whatever strategy you are using to save data to the database. The more that gets written and the more often it gets written the higher the likelihood that you might end up with a corrupted file as your backup script reads it while it’s being written to.

Personally, I don’t stop OH. If I lose the DB for one of my rrd4j or mapdb Items it’s not the end of the world. If I need to do some data analysis that matters I’d save the data off to PostgreSQL or InfluxDB or the like. But I mainly keep some charts up and restoreOnStartup so I don’t do that anymore.

Any backup you take of OH is not going to include these. You’ll have to make a separate backup of these yourself. Each database will have a standard approach for dumping and reloading the DB. Most of them are transactional so you don’t have to stop anything to dump the DB to back it up. But OH isn’t going to do anything to back them up for you, that’s on you.

Hi @rlkoshak thank you it is more clear now.

I‘ve been using OH on docker with nightly backups via Duplicati (just all folders with OH running) for three years now. Since the backup is running at night I did not do any changes during that time like Rich mentioned.

Since then I’ve had to restore the entire system three times (one fire drill, one SD card failure and once I killed my installation). The steps can be found here. So far, all restores worked flawlessly.

1 Like