Why has Home Assistant OS no integrated full backup automation?

I recently switched to Home Assistant OS. Among other things, because of the integrated backup function.

I wonder why there is no automation for backups integrated in Home Assistant OS.

Yes, there are blueprints from the community, but I would find it better if this was directly integrated

hard to beat perfect

I believe this is backing up the home assistant installation (dockered way), rather than operating system.

That is literally the only backup mechanism that exists, whether via this excellent addon (which has saved me twice already), or a blueprint, or manual backups - they all do the same thing, call the backup service. I run Home Assistant OS on my Proxmox server, and I do my automated backups with the Google Drive Backup addon.

And just to be clear, the Google Drive Backup addon, has already enabled me to move my Home Assistant configuration from a Raspberry Pi, to a virtual server, and then later from that virtual server to another virtual server. All that is required is a fresh install of Home Assistant, and then you restore the backup. IP address, addons, everything is restored.

works on docker or OS, an will switch between them.

2 Likes

Just to clarify, it is backing up the he assistant itself right? Not the whole operating system.

There is no facility to backup the entire OS, nor should there be. The simplest way to recover is to fresh install Home Assistant OS, go through the onboarding to create a new user, then restore the backup (the user you just created will be lost obviously).

I think because they think they have it covered with snapshots or whatever.

For the container the process I use is to stop the container, tarball the volume, copy to NAS, start the container. This works for all my containers. I use ansible but its a simple playbook that could easily be done with cron/bash.

I stop the container so as not to jack up the DB, but if you don’t mind the possibility of having to delete it on restore you could do it live.

# ------------------------------------------------------
# Container Backup - Runs a simple container to backup
# another container's volumes.
#
# Variables:
# mount_name: name of backup mount on host
# container_name: Nme of Container to Backup
# volumes: List of volumes to backup
# ------------------------------------------------------

---
  - name: Create Backup Directory {{ container_name }}
    ansible.builtin.file:
      path: "/mnt/{{ mount_name }}/{{ container_name }}"
      state: directory

  - name: Stop Container {{ container_name }}
    docker_container:
      container_default_behavior: compatibility
      name: "{{ container_name }}"
      comparisons:
        '*': ignore
      state: stopped

  - name: Run Backup on {{ container_name }}
    docker_container:
      container_default_behavior: compatibility
      name: backup
      auto_remove: yes
      cleanup: yes
      detach: no
      image: alpine
      volumes:
      - "/mnt/{{ mount_name }}/{{ container_name }}:/backup"
      volumes_from:
      - "{{ container_name }}"
      command: "/bin/sh -c \"cd {{ volume_item.path }} && tar cpvzf /backup/{{ backup_file }} .\""
    vars:
      backup_file: "{{ inventory_hostname }}-{{ container_name }}-{{ volume_item.name }}{{ ansible_date_time.epoch }}.tar"
    loop: "{{ volumes }}"
    loop_control:
      loop_var: volume_item

  - name: Set Container {{ container_name }} State {{ container_state | default('started') }}
    docker_container:
      container_default_behavior: compatibility
      name: "{{ container_name }}"
      comparisons:
        '*': ignore
      state: "{{ container_state | default('started') }}"
1 Like

Ahh yeah I probably should have said docker supervised and addons. Sabeechen’s doesn’t grab containers outside of HA addons.

Going back to OPs question, there is backup function for OS itself as it is not needed. Internal backup function of home assistant would suffice