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

The name says it all. There was a similar post in the 2020 WTH.

There’s also an existing FR asking for basically the same thing.

This would be a huge improvement to HA for a lot of reasons.

I concur.

I see 2 reasons that I would use a remote share to my NAS:

  1. Media Library (which already exists on the NAS)

  2. Off device backups (which I’m currently pushing to Google Drive via @sabeechen’s plug in, but would prefer a local backup for redundancy).

9 Likes

I use samba backup for local backups. Pretty much removes the need to mount a drive for backups.

However mounting devices in general is needed for media, it’s pretty much the only reason I’m using supervised instead of Hassos.

5 Likes

There’s a RFC for this: RFC: Mount Manager · Issue #2564 · home-assistant/supervisor · GitHub

I put up a PR to address the RFC (https://github.com/home-assistant/supervisor/pull/3848) but learned through development of the PR that what we thought is the solution actually isn’t. Not sure what the solution is yet.

1 Like

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.