Backup with Win32DiskImager

I`m a little bit confused about the backup discussions and the problems with that method. My openHAB2 installation is on a Raspberry 3. From my point of view the most secure way to make a backup is to generate an image file from the SD card with a tool like Win32DiskImager. The procedure would need to shutdown the system, but the backup-file would contain all data from the installation. Is there anything wrong with this idea?

2 Likes

Yes, lots.

  • nobody wants to shut down the system for a backup
  • you need to backup the whole system every time you change something
  • you will want to be able to restore parts of the system (such as config or rules files)
  • you’ll need a lot of SD cards and have to do all the ‘inventory’ management (which backup, taken when).

Go install Amanda from the openHABian distribution. It’ll take care of all of this and will still allow you to create SD clones.

For normal users I think its better to shutdown the system and make a full backup on a hard disk, eg. on a PC. The restore will work probably. When you are not changing permanently the system it might be quite ok to do this backup monthly. Otherwise you have to acquire very special knowledge about the system, eg. incremential backup. The restore of such a system is a challenge for each user. On the other hand Im not quite sure about the impact of a permanently running backup task on the performance of Raspberry 3.

No, you’re way wrong.
Upfront: No offense. You’re absolutely free to select whatever system you like and feel to be appropriate for your personal needs.
But when there’s “discussions” on the forum here, we’re not talking about your personal specific needs but about a solution that needs to be applicable to everybody, ranging from openHAB beginners and developers doing multiple changes to config files and Linux packages every day to people that have a working system they rarely change any more that just want to have a SD card clone as protection against HW failure.
Oh, and while a Pi running off SD is a common setup, there’s many more in use out there, and we need to provide a solution to work on a large variety of HW.

The most prevalent duty of a home automation system is to run 24x7, and any need for shutdown, and be it just once a month, is absolutely inacceptable. As is a backup cycle of more than a day. We need to be able to save everyday’s work.
So sorry for my intervention, but to a “normal” (average) openHAB user, going with your method is bad advice.

We (as openHAB experts and openHABian maintainers) do have this special knowledge you talk about and have chosen to add a backup system that does take care of all of this, and that has proven to work in various data center scale setups for years (decades even) as well as for single-Pi-SD-only setups. And yes, even when backing up still-running databases.
Amanda is doing incremental backups (on filesystem level) in parallel to raw-device backup of the partition(s),
and the openHABian based installation provides this to “normal” users without a need for them to understand the detailed inner workings of HW/OS/all applications of your openHAB server.

1 Like

It is a good practise to make a disk image now and then, especially after a major upgrade. But I agree with Markus that it is not a good idea for a “normal” backup procedure.

I use Samba to setup network shares which enable a simple copy/download of configurations etc whenever needed. There are backup scripts and discussions on the forum as well and scripts are also included in Openhab 2, see https://docs.openhab.org/installation/linux.html#backup-and-restore.

Also the backup with Win32Diskimager can be a real pain. Quite frequent writing back a backup to a same size, same brand USB stick fails because the backup file is bigger than what can be deployed to a seemingly identical USB stick. The real block counts can be different between same type sticks and it takes quite a skilled user to sort this out.

Another not so uncommon experience with the diskimager is that there are errors somewhere which makes a restore failure. This may not show up until you try a restore.

To me the above means that a diskimager backup is not safe!

Win32disk images are safe if you tick the verify options. In order to write these images reliably on another sd card you need to shrink them. Unfortunately this is impractical because the shrink script runs in linux.
I installed raspiBackup and configured a differential backup daily on a NAS. The backup script stops openhab at the beginning and then restarts it at the end.
I have a second sd with raspiback installed that is used to restore the full image on a sd mounted on the raspberry. The drawback of this approach is that restore takes quite a long time compared to win32diskimager. the big advantage is that I have access to all the files of the full backup. The nas needs to be mounted as nfs so that hard links replace real files thata are not changed compared to previous backup.
Lionhe

Thank you all for your support. I have learned much about backup in this environment.
I will test some of the solutions, considering the limited performance of the Raspberry hardware.