Yeah, I can see the logs there.
So if I want to mount a drive to the share folder to make it available to all addons, which script should I use?
Should homeassistant.sh with the following content work?
#! /bin/bash
echo "Will try to mount the DataDrive for Home Assistant";
#env;
if mount /dev/sda1 /share/DataDrive
then
echo "Success"
else
echo "Fail"
fi
And how can I make sure that the mounting happens before addos are started?
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
Testing Docker access.
Sleeping for Startup Delay period of 1 seconds
Listing Containers.
addon_2ad4c73a_run_on_startup_addon
addon_de91e161_hassio_onedrive_backup
addon_a0d7b954_nodered
addon_45df7312_zigbee2mqtt
addon_a0d7b954_bitwarden
addon_core_nginx_proxy
addon_5c53de3b_esphome
addon_a0d7b954_plex
addon_a0d7b954_ftp
addon_a0d7b954_ssh
addon_a0d7b954_adguard
addon_core_mariadb
addon_core_mosquitto
hassio_multicast
hassio_audio
hassio_dns
hassio_cli
homeassistant
hassio_supervisor
hassio_observer
executing
#############################################################################
###############/config/startup/startup.d/homeassistant.sh
###############Container: 7369553fe428: tmp/homeassistant.startup.sh
#############################################################################
Will try to mount the DataDrive for Home Assistant
Success
----DONE---- sleeping...
But it seems I cannot access the drive in the folder. df -h (on OS level or with Advanced SSH Terminal addon) does not show the mount and files from the drive are not available in the folder.
Edit: If I add df -h to the script, it shows the mount: /dev/sda1 4.5T 2.0M 4.3T 0% /share/DataDrive
So it seems, that it is only available to ‘homeassistant’ or the Run On Startup-d addon!? The shared folder should be available to any addon, right?
If the mounted drive is only available to the container that the script is executed for, how can I make sure that the drive is mounted before the addon that runs in the container (e.g. Nextcloud) tries to access it?
BTW: If I manually mount the drive on OS level, it works.
Many people use samba mounts. I’m not sure on the specifics of your container. It will work, but it will always need to run after all the containers are up and running otherwise there’s nothing to do.
How to use a samba mount if I cannot access the device?
I do not have an specific container. It’s just Home Assistant OS running on a mini PC. I am not using Docker or Proxmox. Just the OS installation.
This is what causes my problem. The system runs on an NVMe SSD and I want to mount an additional SATA drive. Can’t believe this is so difficult and not a default functionality of HA OS.
I’m not sure how useful this tip will be, but it solved my problem (I wanted to mount a drive in HAOS, to be used by various containers, which sounds a bit like your issue). I thought Run On Startup.d would be perfect, but hit the same problem you are seeing. So I went back to init_commands in “Advanced SSH & Web Terminal”, and Grok gave me this gem:
init_commands:
- docker run --rm --privileged --pid=host --net=host -v /mnt/data:/mnt/data -v
/dev:/dev -v /var/run/docker.sock:/var/run/docker.sock docker:cli sh -c
"nsenter -t 1 -m -n sh -c '/mnt/data/scripts/justDoIt.sh'"
That will run a script (/mnt/data/scripts/justDoIt.sh or whatever) in the host context, so you can twiddle with things like mounts, etc… I’m also using it to start up a couple of containers (Plex and Frigate) where I needed more control than the Add-ons allowed (accessing mounts, hardware, etc…)
You could be something similar with " HassOS SSH port 22222 Configurator" (which I’m using to get access to set this all up) and a remote system doing SSH to trigger stuff, but that isn’t nearly as clean as “init_commands”.
Web UI does not work for me, it opens UI for Zigbee2MQTT add-on instead.
startup.d’s log says nc: bind: Address in use, so I guess it tries to use the same port (8099). Can you make it configurable?