Backup Strategy

  • Platform information:
    • Hardware: Rasberry Pi 3B
    • OS: openhabian-pi-raspios32-v1.7.5
    • Java Runtime Environment: 11
    • openHAB version: OH3

A while back I set up OH2 to start learning about OH and used it to monitor a few sensors. During the installation I moved OH from the SD to HDD, and setup Amanda on the HDD (different partition). Recently, the HDD died and I lost both the OH and the backups. (Not an issue as I was just trying things out and testing OH).

Since I’m starting from scratch, I’m moving to OH3, and will soon start trying to control things rather than just plot a few temperature graphs! So I’m taking back-up more seriously this time…

I’ve been re-reading the docs Availability and Backup (mirroring is new since I last installed OH) and the excellent Amanda guide.

I currently don’t have a NAS (maybe something to setup when I get another pi :grinning:), so use a HDD (not SSD) attached to the pi, and have been thinking about the best backup strategy.

  • Which is considered more reliable, OH on SD card using ZRAM or OH on HDD? If I’m reading the docs correctly you can’t use ZRAM if you move OH from the SD card.

  • Can I set up mirroring on a HDD? And if my SD card fails, how do I copy the mirror to a new SD card?

What do other people do as backup strategy? I have 2 use cases:

  1. A ‘snapshot’ backup that I take just before I make any changes so that I can easily roll back (to the same SD card) if I muck things up. At the moment I remove the SD card, put it in a linux computer and use dd to create and image of the SD card.

  2. A continuous backup so that if the SD card fails, I can restore OH to a new card. I plan to use Amanda for this (and if I keep OH on the SD card, there is redundancy if the HDD fails - assuming the SD card doesn’t fail at the same time!).

Any advice gratefully received.

What are you talking about - A) to run OH off either SD or HDD ?
Or B) to use an SD or HDD as the storage are for your Amanda backups ?
If A), well HDD or SSD as a boot drive is more reliable than SD+ZRAM.
But that’s hypothetical because it is not supported in openHABian so you’ll have to do it all manually.
And it does not mean SD boot is unreliable. Just a little less good.
If B), well it doesn’t really matter as long as you only write there once a day as does Amanda.

Nope.

Your 2 strategies is exactly how openHABian is intended to be used, the only difference is #1 I don’t call that “backup” but “mirroring”. And it’s not one or the other, it’s both #1 and #2.

If that’s not obvious from the docs please tell me how to change them.

Thanks for the reply.

I was referring to which scenario has a higher likelihood of disc failure, either:

  1. Running OpenHAB on an SD card as per the default installation of openhabian. SD cards are known to fail with high read / write activity, though ZRAM helps reduce the number of read & writes.
  2. Moving OpenHAB (root) to a HDD using Option 37 in openhabian-config.

Which option is generally considered more robust?

For me, the difference is that #1 is a snapshot at a point in time that I can roll back to. The reason for this is that when I setup OH2 (a couple of year ago), it took me several goes to get it right. OpenHAB is highly flexible and customisable, which is excellent. However, it means that there is often more than 1 way to do something. E.g. in OH3 you can use either text files or GUI for items etc. I might start down the text file path, and decide I want to change to GUI. Rather than starting a complete install, I would want to roll back to a snapshot taken prior to setting up the text files so I can proceed down the GUI path. I realise that in this example that I could delete the text files, but it’s the idea that after choosing one route, I might decide to go down a different route - and I don’t want to have to go back to a fresh install. When I go through setup, I usually take snapshots as I go, and keep a document describing the steps I’ve taken between each update / installation step. Because of my limited time, It might be a week or 2 later before I decide “No, this isn’t the best way of doing this, lets roll back and try a different way”. A mirror will be a copy of what I am doing in real time (or at the end of the day if that is when it is set to run), not a copy of a point in time

Now I’m in the process of setting up OH3, it will probably take a few goes as I figure things out and work out what works best for me. I’ve already done a couple of fresh installs as I try things out and experiment with it. So I’ve now taken a snapshot of the card using dd after I’ve installed openhabian (first boot), run some updates and installed a few things I know I’ll use like Influx and Grafana. Using a dd restore will take ~ 10 mins rather than an 1-2 hours to get to that point.

Once OpenHAB is up and running how I want it, then I want a continuous back up system, like mirroring or Amanda, in case of a disc fail.

Hope that clarifies why I’m asking these questions. It’s not a complaint, just curious about options.

  1. is no longer supported in openHABian you must be using an ancient version.
    So that’ll answer your question as well.

Well this is not what mirroring, snapshotting and Amanda backups are for. Those are meant for the whole system which is including all 3rd party programs besides OH and their config such as databases or the MQTT broker.
You can “backup” and restore OH cofigs using menu 50. This is what you should do when you experiment with configs.

Thanks for clarifying. I now have a plan on how to install and back up :+1: