Bind new volume on homeassistant container installed via hassio_install.sh

Hi there,

I installed hass.io via the hassio_install.sh script and I
am now wondering how you’re supposed to add a docker volume bind to the homeassistant container.

docker ps shows me I have multiple containers running.
Two of these are homeassistant and hassio_supervisor.

CONTAINER ID        IMAGE                                               COMMAND                  CREATED             STATUS                 PORTS                              NAMES

e0b29b44ca41        homeassistant/raspberrypi4-homeassistant:0.100.2    "/bin/entry.sh pytho…"   3 hours ago         Up 3 hours                                                homeassistant
0d2e99c597b5        homeassistant/armv7-hassio-supervisor               "/bin/entry.sh pytho…"   10 hours ago        Up 3 hours                                                hassio_supervisor

To my understanding hassio_supervisor starts the homeassistant container via homeassistant.py

I would like to add some docker bind volumes (external hard disks) to the homeassistant container.
Can someone advise me on how you are supposed to do this when using hassio_supervisor?
I can’t find any options on how to let hassio_supervisor know it should start homeassistant with additional mounts.

I also don’t find much on hassio_supervisor.
The installation script added /usr/sbin/hassio-supervisor with a “docker run” command for hassio_supervisor in it.
From there I can easily add volume binds to hassio_supervisor via “-v myDir:/myDir” commands.
But I’m missing the information how to do the same for the homeassistant container.

Thank you very much for your help.

2 Likes

Hello,

So, I encountered a problem with adding as a sensor, the size of MariaDB database. The path to that database was outside of what HA container could access.

usr/share/hassio/addons/data/core_mariadb

Trying to whitelist that specific folder resulted in an error.

not a directory @ data['whitelist_external_dirs'][1]

Solution:
Find the homeassistant contaner SHA:

docker ps

Stop homeassistant container:

docker stop homeassistant

Stop docker service:

sudo systemctl stop docker

Navigate to:

/var/lib/docker/containers/<SHA>

I added in hosconfig.json, under Binds the path to addons:

    "Binds": [
        "/usr/share/hassio/homeassistant:/config:rw",
        "/usr/share/hassio/ssl:/ssl:ro",
        "/usr/share/hassio/share:/share:rw",
        "/usr/share/hassio/addons:/addons:ro"
    ],

I added addons mount configuration in config.V2.json, under MountPoints:

        "/addons": {
            "Source": "/usr/share/hassio/addons",
            "Destination": "/addons",
            "RW": false,
            "Name": "",
            "Driver": "",
            "Type": "bind",
            "Relabel": "ro",
            "Propagation": "rprivate",
            "Spec": {
                "Type": "bind",
                "Source": "/usr/share/hassio/addons",
                "Target": "/addons",
                "ReadOnly": true
            },
            "SkipMountpointCreation": false
        }

Reboot the server, and that’s it. Now is possible to reference that folder inside HA.

3 Likes

Oh man… I was looking for this so badly!

Thank you - would you happen to know if this change will persist across upgrades (ie: through Supervisor?)

1 Like

If you are running HA OS then these changes won’t survive the OS reboot.
Any idea to get around this?