Mount remote smb share on hassio

Hi, I need mount remote smb share on hassio and use it as storage for different use that need big storage instead internal disk (or sd with rpi) or external usb drive, so mount a remote smb share (mainly on nas) is a better solution and seems strange that hassos not already support it.
I saw that hassos don’t have cifs support so I did a patch that add it and did a PR about it: https://github.com/home-assistant/hassos/pull/408
With modified hassos I can mount manually smb share on hassos and if I mount it in subfolder of /mnt/data/supervisor/homeassistant I can use it from anything on hassio.
I tried to do an addon that have cifs-utils for mount it at boot and maintain it including future update, backup/restore, set/change share configurations from hassio gui ecc…
Unfortunately mounted share is not visible on hassos, hassio and other container because bind of /config is setted with bind-propagation rprivate (default) and I can’t set to private instead in map parameter of addon’s config.json because seems don’t support it, or I’m wrong? I tried to search other method but I not found another way to share the mounted share content with other containers.

Can someone tell me how to solve or workaround the problem please?

Thanks for any reply and sorry for my bad english.

4 Likes

I think it would be better overall to install Hassio on Raspbian Lite. You then have all the Raspbian features except the CPU intensive graphical interface.

That is what I run at home.

Thanks for reply, I already know that using rasbian or other gnu/linux os I can have cifs support already included and use it for example simply add mount in subfolder of one bind of hassio container in /etc/fstab.
I want instead use hassos for doing a device or vm dedicated to hassio, with simply and fast update, backup/restore ecc…
About add cifs support in hassos I already did a patch and did a PR (link in first post) about it, about addon that mount smb share at boot, with easy/fast configuration and that can included in backup ecc… I’m already doing but I’m blocked for addon container bind without bind-propagation setting (I mean about docker container configuration of the addon) support or other way to share mounted share between containers.

My concern is that HassOs was designed as a lightweight hypervisor for Hassio. If too much low usage complexity is added, that defeats the original purpose.

You can run the Pi as an appliance with Raspbian Lite. That is basically what I do In initial testing on VirtualBox with HassOS I had several unresponsive network issues that were only resolved by a reboot of the VM. Raspbian on Pi is much more mature.

I don’t even understand what you are trying to do… the Samba Addon lets you see the hassio folder on another machine - config, backup, share.ssl and addons… anything outside those folders is beyond the systems design

I already know that samba addon share hassio folder but I need reverse thing of connect hassio to remote share (mainly on nas) and use them as storage, usb pendrive or hdd connected to hassos device (based on what support hassos for now) is not the better solution (at least for our goals for our customers).
Remote storage for example is useful for example also if want store something offside, for example manage video surveillance from hassio but storage it on remote datacenter.

4 Likes

Another mount option, perhaps supported by HassOS is nfs mounting. That is more native to Linux. cifs mounting uses parts of Samba to inter-operate with Windows.

Hello, did anyone find a way to do it :frowning: ?

I could achieve this momentary but after a restart lost it all. You have to mount your share folder a folder within share folder via cifs. This is only possible if you are HA installed on top of raspbian light.

hassos 3 add cifs as module kernel, addon that load it and have cifsutils can also mount cifs

I missed this when it first came up in May.

If I read this correctly, I think Fantu was originally asking if there’s a way to mount an external device, like a NAS, to HA. We already know HA can offer an SMB share to other devices. It would be great to be able to go the other way.

For example, HA collects some data about my heating and cooling systems and stores them in a file I can analyze later on another device. Right now I have to store those files on my Raspberry Pi running HA (on Hass.io) then move them to my NAS for long-term storage.

It would make more sense for my automations to save directly to the NAS.

I was a little surprised to find that this not built in to HA, or at least an optional add-on.

6 Likes

I’m facing this same issue right now. I need to mount an SMB (an external drive connected to my router) to my hassio and, to my surprise, there seems to be no solution. Any solution in sight?

Thanks!

Have you trying that?
Im getting the following when im trying to load a module.

~ $ modprobe cifs
modprobe: can’t change directory to ‘/lib/modules’: No such file or directory
~ $ cd /lib/modules
-bash: cd: /lib/modules: No such file or directory

This is precisely what I’m trying to accomplish. The ultimate goal is to allow recording of camera streams and snapshots of cameras to be saved to and stored on a NAS on my network running smb/cifs . I would greatly appreciate any insight others might be able to contribute towards a solution.

2 Likes

Wow just stumbled here and have this exact need (download streams and I have a recursive auto-delete for older than X days). I just migrated from HA Core install (directly in Ubuntu using pip3 command) onto Hass.io and I cannot get the downloader HA component to work. On my HA Core it obviously works because /etc/fstab has the proper CIFS mapping to my NAS. In Hass.io I still have the issue and tried desperate things like tweaking the homeassistant docker config.v2.json file to add the mount point (docker mount point hack which definitely works)… so far it completely blew up the Hass.io (supervised) install and I had a hard time getting Samba add-in to work again. Had to stop the supervisor service and remove all docker containers and start over — but it didn’t whack the config folder.

I’ll keep messing with fstab and possibly settle on an NFS share — but completely agree with you that access to any parent machine folders or even remote hosts is a must.

I’ll respond to myself as it’s the only workaround I found with the supervised hass.io… basically use HA to run an automation (shell command) to mount NFS — because CIFS would not cut it. Thankfully my QNAP was simple enough to enable permissive NFS access.

Here are things that failed:

  • Using rc.local
  • Using fstab
  • Mounting CIFS in the homeassistant Docker container

This NFS mount worked and it runs after Home Assistant starts:

configuration.yaml

shell_command:
  map_nas_video_folder: mount 192.168.0.100:/_NASVIDEO /mnt/_NASVIDEO

automation.yaml

- alias: Map NFS Drive to HassIO
  id: map_nfs_drive_to_hassio
  initial_state: 'on'
  trigger:
    - platform: homeassistant
      event: start
  action:
    - delay: '00:00:15'
    - service: shell_command.map_nas_video_folder
1 Like

In hassos from version 3.2 there is cifs kernel support as module:

One year ago I proposed to add it as built-in instead loadable kernel support and add cifs-utils in hassos and/or hassio but was rejected.
For use cifs in hassos (>=3.2) is needed addon that load the cifs kernel module and have cifs-utils, is not possible do an addon that share cifs mount to other container because hassos don’t have possibility to set bind-propagation to shared in addon container.
In case is used other operating system (not hassos) should be possibile mount cifs in it and share it with a bind to container FWIK.
About better cifs support in hassos and/or hassio container if useful / necessary to many people I think it would be necessary to request it again if possible add it (to hassos / hassio developers).

1 Like

A workaround would be to install a folder monitoring app that monitors the /config/mysubfolder share and moves security cam snapshots and vids to a NAS to prevent the hassio drive from filling up.

I was looking for a way to mount NAS shares to utilise the PLEX add-on and MotionEye addon in Home Assistant. It seems like these two add-ons are pretty well useless if we cannot mount external storage of some kind.
Did anyone work out how to mount a CIFS path in HA? They seem to point to using /share as a mount point but I have no idea how to make this work.

5 Likes

Ok, so I managed to make this work, having a cifs folder mapped to a HA running supervised under docker.

I logged in HA container using Portainer ssh as root, added the fstab entry pointing to a folder under /mnt (for some reason it wouldn’t let me create a mount in /some_new_folder

Now the problem was that every time I started HA I needed to run mount -a. This issue was fixed by adding a startup automation with a 2 minutes delay that runs a shell_command.

Now I can monitor the network shared folder using command_line sensors and take actions using shell_commands

Will edit this later if needed with more detailed information