WTH Can't I mount a Remote Share (NAS, SMB, NFS, etc) in HAOS?

The premise of the question is to gain enough access to mount a drive. All that requires is root.
The warning is telling you if you mess it up, you now have un-supported set-up and you have to fix it yourself or re-install. Don’t ask for help.
Just like core install or supervised using Debian or Portainer.
Developer level access gets you the mount, but you lose the safety net.
You ask why this isn’t a user level thing? That’s why. But you can certainly do it.
Just like most of the phones in the country. No root access for good reason. It also means you can’t do some stuff that requires it. If you gain root access, you loose support and you are on your own.
So you can do it, you just better know what you are doing…
In the real world it’s no scarier than using supervised with my Plex data drives mounted using like I am currently doing. I just recently came across this in the Docs and plan on converting to HAOS and doing this to mount those drives so that I can get Bluetooth to work soon.

I guess we read the premise of the question differently. I sort of assumed (yes, I know!) that the OP meant that HA should have this as a built-in capability. I’d even settle for an add-on, sort of like the reverse of the SAMBA Share add-on. One that a mere mortal can do, and receive help for if they flub it up.

Frankly, most of the post above might as well have been written in a foreign language for most non-experts. Sure, I can do it. In theory, I also can perform brain surgery. I don’t think I should though.

And to continue your analogy, I can access the local storage on my phone, and my phone can access my local NAS, without rooting the phone. I don’t have to know how it works, just install the right apps.

3 Likes

I read the question more as “Why can’t I mount a Remote share from the UI?” With shell commands there is very little we can’t do but I don’t expect everyone to learn how.

4 Likes

So what’s a good guide on how to do that in the YAML world? Thanks for sharing :slight_smile:

At least two of the prior posts have yaml for mounting a share. That sets up a service. The service must be run every time HA reboots. I just use an automation run after boot. Make sure the automation waits for full boot or at least put the yaml toward the very beginning of the config.yaml. Definately before automation’s are loaded! Otherwise it may get called too early and not work properly. It’s extremely simple but let me know if you have an issue.

1 Like

Here is a video about this. It’s a bit older, but this still works today…

And here my setup:

config.yaml:

# Mount NAS drives
shell_command:
  mount_nas_music: mkdir -p /media/NAS/Music;mount -t cifs -o username=Username,password=PASSWORD,domain=DOMAIN //192.168.178.100/Music/Musicaudio /media/NAS/Music
  mount_nas_movies: mkdir -p /media/NAS/Movies;mount -t cifs -o username=Username,password=PASSWORD,domain=DOMAIN //192.168.178.100/Movies /media/NAS/Movies
  mount_nas_musicmovie: mkdir -p /media/NAS/Musicmovie;mount -t cifs -o username=Username,password=PASSWORD,domain=DOMAIN //192.168.178.100/Music/Musicmovie /media/NAS/Musicmovie

automation:

alias: Mount NAS on start
description: ""
trigger:
  - platform: homeassistant
    event: start
condition: []
action:
  - delay:
      hours: 0
      minutes: 3
      seconds: 20
      milliseconds: 0
  - service: shell_command.mount_nas_music
    data: {}
  - service: shell_command.mount_nas_movies
    data: {}
  - service: shell_command.mount_nas_musicmovie
    data: {}
mode: single

The 3 minutes delay seems to be necessary (but can be shorter depending on your setup), other ways the automation is executed to early and does not work. :wink:

3 Likes

I approve! Chris knows what he is doing and it appears to be the same way I do it so I double approve. lol The only important note and Chris mentions it is that the command might need to be adjusted depending on mount type.

1 Like

That is why I mentioned you can put the shell command before the automation’s load. I don’t have a delay set and it works fine because the shell runs before the automation fires. It doesn’t appear HA wait’s for everything to load.

1 Like

I will have to try this. I gave up on getting my NAS connected after many failed attempts using this method. Maybe the delay will sort it out. Thanks

1 Like

If it is only an issue with the delay then you should be able to call the service manually after everything has booted. That should point you in the correct direction.

The inability to mount external storage may be a deal breaker for me. As much as I love HA, this is such a basic, necessary function for so many add-ons and integrations, it beggars belief it isn’t a standard component.

3 Likes

Why do we have to resort to this;
[SOLVED] HASSOS mount NAS network share - #127 by ukro

Additionally, why is it now possible to write backups, but not read from a Samba share;
https://community.home-assistant.io/t/samba-backup-create-and-store-backups-on-a-samba-share/

1 Like

Why should we have to resort to that? There’s talk on another thread about making HA easier for beginners.
This should be a core functionality, not something you need an in-depth IT background to support.

1 Like

There’s a pretty simple write up here… which uses shell command and couple sensors to make sure the nas is available. It’s for frigate. But you can use it for anything

1 Like

The addition of a sensor to make sure it’s available is a good idea. I might add that to mine along with an attempt to remount if not available.

I’ve basically given up on this. I’ve spent hours pulling my hair out trying to use mount commands without success. I can see my samba server shows an active connection, but when I create files and folders they don’t show up. Seems like the only way I’ll ever get a frigate server is to buy a separate computer and storage and run it off a docker. It’s quite stupid to think that the frigate HA addon has no decent documentation or guide or anything for mounting a network share. You’d think that would be a basic function of HAOS, I guess we should be appreciative that we even have HA to being with.

1 Like

Join the club!

I’m a little surprised you are having so much trouble. I recommend you just give it a break and come back to this in a week or so. Some systems are a little finicky I suppose.

It wasn’t any easier the second or third time I approached it. Is anyone actually capable of mounting a share to a remote file system on Hassio/haos or whatever it’s called.

Joining the crowd in here. While on paper my NFS mounts should work this way too, I’ve not been successful yet and pretty much have given up on all things media-related within HA. They work everywhere else though, so, eh.

I do think it’s far too tedious to have to set this up manually, too. I do have an integration with my NAS (since it is running OpenMediaVault), but said integration fails often and, anyway, doesn’t provide a media source. Nor would the TrueNAS integration, if I were to eventually move my NAS setup there.