OpenHAB - How to setup backup procedures

How to setup an automatic daily backup for the most important OpenHAB configurations.

Using the openhabian-config item:

50 | Backup/Restore       Manage backups and restore your system ?    

it is possible to install all the needed backup environment for the open-source software Amanda.

The github backup tutorial explains well enough (and it's strongly suggested to read it all before proceeding with the installation) but there are some details to take care in order to have a system working fine. There are many threads on the OpenHAB community related to installation issues (example). Most of them are related to how the backup volume is mounted, either a NAS or a USB local drive.

In my installation I mounted a 16GB USB pen drive on one of the two CM3-Home USB sockets. First of all, it's better to format the volume with an EXT4 filesystem to be able to use all the Linux capability. With a FAT32 filesystem for example, it's not possible to create the symbolic links needed by Amanda to run. After the mount point is created, to have the volume mounted at startup it needs to add a line to /etc/fstab file. In my configuration:

dev/sda /media/usb ext4 defaults,noatime 0 1

Only after the backup volume is correctly configured the Amanda installation can proceed. As well as in this example to me too the installation was not correctly executed. The script returns no errors, but exiting from openhabian-config it's possible to read the console messages. Has suggested from the script author on the aforementioned thread, you have to manually create the symbolic links shown on the error messages to have the system working.

The rest of the installation script works fine creating all the virtual tapes structure on the backup volume, the configuration files and the cron entry to start the full and incremental backups in rotation every day at one o'clock in the morning.

I suggest to add to the /etc/amanda/openhab-dir/disklist configuration file some more folders to backup, in addition to the default ones, according to your own needs, binding and external programs installed. In my installation:

OHASIS  /etc/openhab2             user-tar
OHASIS  /var/lib/openhab2         user-tar
OHASIS  /usr/share/openhab2       user-tar
OHASIS  /etc/default              user-tar
OHASIS  /home/openhabian          user-tar
OHASIS  /etc/amanda/openhab-dir   user-tar

ATTENTION

Remember to save this and any other configurations somewhere because if you reinstall Amanda the disklist file will be covered with the default one.

Guido Ottaviani (Author/Designer/Developer for electronics-firmware-robotics)
He deals with electronic design and embedded system firmware for Robotics and industrial and civil applications, as well as technical disclosure on the internet.
http://www.guiott.com - https://github.com/guiott - guido@guiott.com



Le attività del TanzoLab si svolgono ogni mercoledi sera, salvo casi speciali, dalle ore 18:30 presso i locali della Acme Systems srl e consistono in:

  • Talk monotematici a cura di professionisti in vari settori tecnologici
  • Workshop pratici su elettronica embedded, produzione e informatica
  • Progettazione e realizzazione di nuovi prodotti embedded per l'IT

Le attività vengono coordinate tramite questo sito, in cui vengono pubblicati tutti i lavori svolti o in via di sviluppo, e tramite un gruppo Telegram con cui per interagire direttamente via chat con gli altri membri.