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

Would love a simple way to add external storage from a NAS or other computer to Home Assistant. This would make it easier to get to music for Music Assistant and to store and playback videos for my video cameras using the frigate add on.

2 Likes

I’ve used that too, and it’s a nice add-on. But it does not remove the need to mount a drive. As an example, I currently have automations which save data to comma-delimited text files which I can use outside HA to analyze data from my heating and cooling system, among other things. Saving these directly to my NAS, rather than having to copy them there periodically, would be a big improvement.

Another oft-cited example is playing media files stored on a media server.

The add-on you mention (and the excellent Google Drive Backup add-on) simply take the backup file which HA created on the local drive (or SD card) and copy it to external storage. Since local storage can be tight, and SD cards have limited lifetime writes, a far better solution would be to create the backups directly on an external storage device in the first place. Adding the native ability to mount a NAS share in HA would be the first step toward fixing that problem, too.

1 Like

My man, did you read my full response? I’m not here for an argument or discussion, I agree with you.

6 Likes

Of course, and I thank you for clarifying. I was responding to your first line. Anyone who read only up to that point could decide this particular WTH is pointless and move on without reading further.

Would love a simple way to do this! For having a tablet on the wall and the screensaver images on the nas, or mount a music folder. maybe they can use similar code to photoprism, hat runs in docker on one machine and has access to a network share. FAQ - PhotoPrism

This is what needs to be done in photoprism:

services:
  photoprism:
    volumes:
      - "photoprism-originals:/photoprism/originals"   

volumes:
   database:
     driver: local
 
 
   photoprism-originals:
       driver_opts:
         type: cifs
         o: "addr=192.168.1.110,username=admin,password=pswrd,rw"
         device: "//NAS/photos"
1 Like

its already done with the Samba Nas Addon, works great!

i use it since the beginning and do all you are expecting to :wink:

1 Like

The request is to be able to mount a drive on the network within haos so, for example, an automation could write files directly to a NAS sever or large volumes of media files could be stored on a NAS and made available to HA.

What that add-on does is to allow a device on the network to access the home assistant folder for backup / config changes etc.

So, the add on is inbound, the request is for outbound.

2 Likes

Yeah, I moved to container install mostly because of this problem with mounting a network drive. As a side benefit, I then discovered that Duplicati does a much better (faster, less storage) backup than the HA system backup.

1 Like

I use a share on another device. Currently I use shell and an automation that runs it after boot. I would love to have a better way!

shell_command:
  link_nas_share: mkdir -p /media/ha;mount -t cifs -o vers=3.0,noserverino,username=username,password=password, //192.168.1.11/Share
2 Likes

Yeah I want to push recordings from Frigate to my NAS for backup too.

There’s several addons that can implement it, each in their own way, but that doesn’t let you access it in all addons like a core HA network mount option would.

I believe the way I do it shown above should allow that too.
EDIT:
Documentation says:

If you are using Home Assistant Operating System, the commands are executed in the homeassistant container context.

I’m running Hass OS, and it looks like there is a big difference between the community add-on “SSH & Web Terminal” and the official add-on"Terminal & SSH", with the latter I’ve attempted to manually mount the drive for weeks tried every way I cpuld imagine, and no luck, but with the community add-on it mounted immediately.
Question is, if you put it in an automation, which kind of linux is it running from? So I would definetely agree with getting the mount option in the settings, so there will be no confusion, and then have a way to make it a ‘loose’ mount, so it doesn’t hang or error on it, if the external drive is not available at boot time (some people turn off their nas at night).

You already can…
configuration.yaml

shell_command:
  mount_media_folder: mount -t nfs4 <NAS IP address>:/volume/dir /media

And add automation…
Trigger: When Home Assistant is started
Action: Shell Command: mount_media_folder

Something makes me think you may have not read the whole thread. I’m guilty of that sometimes myself.
.

Because you can already get root and map any drive you want…

Look at that link again:

This section is not for end users…
This is for developers of Home Assistant.

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: