Mounted folder does not show in Media Browser - Home Assistant Container

I am running HomeAssistant container, not supervised, in a Ubuntu desktop PC.

I want to mount my synology nas to be able to browse it through “Media Browser”.
I have created a file called “media” in my configuration file, and added the following to “configuration.yaml”

homeassistant:
  media_dirs:
    media: /config/media

I have created some dummy files and folders in the media folder, just to make sure that I can view local files. And I have created a folder called synology which is used as mountingpoint. The entire directory under config looks like this:

media/
├── fake.mp3
├── synology
│   ├── CloudStation
│   ├── Dokument
│   ├── download
│   ├── DropBox
│   ├── Git
│   └── www
└── testdir
    ├── fakefile.mp3
    ├── fakefile.txt
    └── testdir2

I have tried to mount the synology NAS with two different commands, as I read somewhere that someone had difficulty using smb:

sudo mount -t nfs4 -o rw 192.168.1.122:/volume1/homes/MyName synology/
sudo mount -t cifs -o user=MyName,vers=3.0 //192.168.1.122/homes/MyName synology/

Both work if I access the Ubuntu computer via ssh and list the files with “ls”.

However in Home Assistant web I can only see the local files:


I have found a similar topic but the solution there did not work for me:

From the docs:

Please note, that the folder must be accessible locally. Home Assistant cannot connect to external or remote network shares using this configuration option.

Does this mean I cannot access files that are mounted?

Below I have copied the system info:

System Health

version: core-2021.10.3
installation_type: Home Assistant Container
dev: false
hassio: false
docker: true
user: root
virtualenv: false
python_version: 3.9.7
os_name: Linux
os_version: 5.11.0-44-generic
arch: x86_64
timezone: Europe/Stockholm

logged_in: false
can_reach_cert_server: ok
can_reach_cloud_auth: ok
can_reach_cloud: ok

dashboards: 1
resources: 1
views: 4
mode: storage

Not sure how docker works with mounted nfs volume inside a bind mount.
Maybe try to create a docker nfs volume and attach it to the HA container?

This fixed it, thank you. For future reference on how I implemented it.

Create docker nfs volume:
docker volume create --driver local --opt type=nfs --opt o=addr=192.168.1.122,rw --opt device=:/volume1/homes/MyName --name nfs-docker

Then to attach it to the HA container with:
--mount source=nfs-docker,target=/config/media/synology \

My full docker run command:

docker run -d \
  --name homeassistant2 \
  --privileged \
  --restart=unless-stopped \
  -e TZ=MY_TIME_ZONE \
  -v /home/henrik/develop/ha_installation:/config \
  --mount source=nfs-docker,target=/config/media/synology \
  --network=host \
  ghcr.io/home-assistant/home-assistant:stable

I have created a mount point to the media folder in my Synology to my home-assistant instance

This is how my docker-compose looks like

  homeassistant:
    container_name: homeassistant
    restart: unless-stopped
    privileged: true
    environment:
      - PUID=$PUID
      - PGID=$PGID
      - TZ=$TZ
    volumes:
      - $DOCKER_SOCKET:/var/run/docker.sock
      - $LOCAL_TIME:/etc/localtime:ro
      - $PERSIST/homeassistant/config:/config:rw
      - /volume1/Media:/config/media/synology:ro
    ports:
      - 8123:8123
    working_dir: /config
    image: 'ghcr.io/home-assistant/home-assistant:stable'

Then, in configuration.yaml, I defined my media dir by:

  media_dirs:
    media: /config/media

and that is it. all easy to use now :slight_smile:

I have same problem as the root topic - but i use HA OS. Is there a chance to solve it?