[SOLVED] HASSOS mount NAS network share

yes last bios version. I’m searching around if there is others driver to install

let me know if you will be out of option i can connect and try to fix, further i have no idea what to do

I managed to kill my docker lxc and decided to try frigate in hassos again. And so I filled up my root partition again with camera footage, so I decided to use your script.
It worked nicely! Saves a bit of work. Thanx.

In addition, I had to mount sdb8 (normal mount works fine here) in the VM as well to clean up the media files. There is no gui element to make some room after your disk has filled to 100%.

1 Like

:smiley: nice !
Thank you for info, happy to help :slight_smile:

Please vote for my feature request that asks for this to be a native function of HA:

1 Like

Bigger FR is here.

I have also been various approaches to coral usb passthrough working to no avail. Would you mind helping me out over here in this thread?

The release 2022.3 made it posible with a new integration. :clap:

wut wut wut???
Give me please direct link where its written that media folder is possible to mount?

I looked through the release notes - couldn’t see it there?

1 Like

I couldn’t find anything either, please share @Yves_IF please, pretty please?

I successfully mounted an SMBv3 share following this post:

Basically:
config:

homeassistant:
  media_dirs:
    multimedia: /media

config:

shell_command:
  mount_multimedia: !secret shell_mount_multimedia

secret:

shell_mount_multimedia:  'mkdir -p /media/multimedia && mount -t cifs -o username=foo,password=bar //192.168.12.34/media /media/multimedia'

And the automation at homeassistant startup with service:

shell_command.mount_multimedia

So to clarify, the ‘secret’ url for the media directory on your NAS is simply listed as:
//192.168.12.34/media /media/multimedia

…so it would be:

shell_command:
  mount_multimedia: //192.168.12.34/media /media/multimedia shell_mount_multimedia

Is that correct? Because I’ve struggled to get this working with my setup.

(for the record you don’t need to hide internal IP addresses, but I get that the secrets file can be a handy place to reference for when you need to change something in a central location)

Your post has different paths, which is confusing, likely a mistake, and probably won’t work for most people. Specifically, you are pointing HA to /multimedia, creating a new directory /mnt/multimedia, and mounting the network path on /media/multimedia. That doesn’t sound right.

Hi @denilsonsa , would you mind helping me fix my config?

Currently I have a NAS share at 192.168.0.15 called music and another called movies. I’d like to link both of those to the HA media browser but my config below doesn’t work.

shell_command:
  mount_nasmusic_folder: mkdir -p /media/music; mount -t cifs -o 'ro,username=MY_USER,password=MY_PASSWORD' //192.168.0.15/music /media/music

I don’t have much Linux knowledge so the above is purely cope/paste from others and substituting my details.

This is what I’m using Dave, hopefully it helps:

shell_mount_movies:  'mkdir -p /media/movies && mount -t cifs -o username=xxx,password=xxx //192.168.60.177/movies /media/movies'

From my previous experience the problem is that this shell mount was only for homeassistant docker, not for Frigate. Can you confirm that realy the recordings are saved on nas?

@sparkydave @denilsonsa I’m sorry, I made some mistakes by obfuscating and simplifying the configuration. I edited the post with correct version

1 Like

No I can’t. I think you are right, this is only for HA Docker.
I didn’t catch at all the point of the post, sorry.

@sparkydave, your command-line seems sane. But maybe the issue is in quoting. Unless you use weird characters in your password, you don’t need the quotes on the parameter after -o. Instead, what I would suggest is to add quotes around the whole command.

# Try replacing this:
shell_command:
   mount_my_folder: mkdir … ; mount … -o 'ro,…' //192… /media/…
# With this:
shell_command:
   mount_my_folder: 'mkdir … ; mount … -o ro,… //192… /media/…'

In the second example above, the quotes are around the entire command, which explicitly tells the YAML parser this should be treated as a string. Well, YAML can automatically detect strings even without quotes, but YAML syntax rules are weird and can sometimes lead to unexpected results.

If you have weird characters in your password, try limiting to letters, numbers, and a few “safe” symbols: ._-+=:/@%^. If you insist on using other symbols, then you need to figure out how to safely escape those characters both in the shell syntax and in YAML.


But maybe your issue is somewhere else…

The whole setup is made of three parts (or four parts, depending how you count):

  • media_dirs configuration, which tells HA where to look for media files. If you’re running HA inside a container (and a HAOS install does run the HA core inside a container), please be aware this path is inside the container filesystem. See the documentation: Media Source - Home Assistant
  • shell_command that would create and mount the shared folders.
    • To avoid accidentally exposing the credentials if/when you share your main configuration.yaml file, you can move the entire command to secrets.yaml. See the documentation: Storing secrets - Home Assistant
    • We are actually chaining two commands in a single command line:
      • mkdir to create a new directory. The -p means “create any parent directories as needed, and don’t complain if the directory already exists”.
      • mount to actually mount the network share into that directory.
    • We can chain commands using:
      • ; → the second will run regardless of the state of the first one
      • && → the second will only run if the first one succeeded
      • || → the second will only run if the first failed
      • For our purposes here, both && and ; would work just fine.
    • This overview is enough for our purposes. If you want to learn more about this subject, look for tutorials and lessons about UNIX shell, sh, and bash.
  • An automation that would run the shell_command during the HA startup. See the documentation: Shell Command - Home Assistant and Automation Trigger - Home Assistant

If all these parts are correctly set up, the whole thing should work. If it doesn’t, look for clues and error messages in Open your Home Assistant instance and show your Home Assistant logs.. You can also manually trigger the automation Open your Home Assistant instance and show your automations. or manually call the shell_command service Open your Home Assistant instance and show your service developer tools. and then look for new error messages in the logs. Finally, you can also use ssh to open a shell inside your HA container and then you can inspect the directories and see what’s happening. Explaining this is beyond the scope of my reply, but this requires just some basic UNIX/Linux skills.