I’m using HAOS.
I have successfully mounted an NFS Share, by ssh-ing into HAOS and manually entering the following command:
mount -t nfs4 192.168.6.10:/mnt/truenas/recordings /usr/share/hassio/media/
Struggled with that for a bit. The key was using nfs version 4.
However, the mount is not persistent across reboots.
I read that a ‘hackable’ solution would be to create a shell command and to set it to fire upon system start, through an automation. Here are the pertinent config file sections:
configuration.yaml
shell_command:
mount_media_folder: mkdir -p /usr/share/hassio/media;mount -t nfs4 192.168.6.10:/mnt/truenas/recordings /usr/share/hassio/media/;touch /config/testfile.txt
automations.yaml
- id: '1676160363936'
alias: Map NFS drive on TrueNAS to HA
description: Map NFS drive on TrueNAS to HA
trigger:
- platform: homeassistant
event: start
condition: []
action:
- delay:
hours: 0
minutes: 3
seconds: 20
milliseconds: 0
enabled: true
- service: shell_command.mount_media_folder
data: {}
mode: single
Results: The directory gets created and the /config/testfile.txt date/time gets updated, but the mount does not get mounted.
I have fiddled around with setting greater delays, but all to no avail. The nfs share never gets mounted. I also changed the path to /config/hassio/media. Same results.
Also, in my testing, I created a CIFS mount on my truenas box, and again manually got it to mount inside an ssh session, but it was not persistent either. My preference is to use an NFS mount.
Lastly, back working on the NFS mount method, I tried to manually run the mount_media_folder shell command service from within HA, and again, the directory gets created and the timestamp on my testfile.txt gets updated, but the mount does not happen.
Could someone please give me some guidance on how to get the NFS mount to execute on system start?