Mounting NFS share

Im trying to mount an NFS share in Homeassistant. Im running it from a virtual machine / vmdk. The mount location is a nfs.

Ive tried through both ssh and shell_command.

This is my shell command:

shell_command:
  mount_ai: mount 192.168.2.244:/mnt/ai /config/www/img 

The folder exists. It eorks from other systems.
Home assistant gives error 255 in the log, or permission denied from SSH.

What am i overlooking?

Is your IP permitted to connect to this NFS share?

Yes, it is allowed. At this moment ip is allowed through wild card because i wasnt sure hass would connect with regular ip or some other due to docker.

Is there anything in the log of NFS Share machine?

Thanks for responding.

The log says:

Nov  3 20:48:07 python-ai kernel: [173513.350349] nfsd: exp_rootfh(/mnt/ai [00000000bd24f65f] *:sda2/918277)
Nov  3 20:48:07 python-ai kernel: [173513.350352] nfsd: fh_compose(exp 08:02/918277 mnt/ai, ino=918277)
Nov  3 20:48:07 python-ai kernel: [173513.351349] nfsd_dispatch: vers 3 proc 0
Nov  3 20:49:24 python-ai kernel: [173589.823525] NFSD: laundromat service - starting
Nov  3 20:49:24 python-ai kernel: [173589.823526] NFSD: end of grace period
Nov  3 20:49:24 python-ai kernel: [173589.823528] NFSD: laundromat_main - sleeping for 90 seconds

If I try to mount an NFS volume from built-in “Terminal & SSHl” add-on, I get permission error (not sure if this is the same error that you see). However, when I try to mount using the “SSH and Web terminal” add-on, the nfs mount works using the command:

mount -t nfs4 YOUR_NFS_IP:/YOUR_NFS_SHARE /mnt

I believe because the commands are likely executed in a different container.

Hello,

You can introduce the following command in your configuration.yaml :

shell_command:
  mount_media: mkdir -p /media/Volume1/...;mount -t nfs4 NAS_IP:/mnt/Volume1/... /media/Volume1/...

Then make an Automation that executes the shell_command “mount_media” at homeassistant startup

It is important to allow nfs access to the folder in question on your NAS if it blocks it by default.

Best regards

nice Tip. Didn’t realize you can do it with one line.

simplifies things! :slight_smile:

Hello there. I’m trying to do the same thing. I haved added all the configuration on my NAS (unRaid) and on HOAS. The config is pretty the same as OP but when I check the log of unRaid I see that :

Dec  1 14:47:30 unRaid  rpc.mountd[12585]: v4.0 client detached: 0xcde37f9b638883ac from "192.168.50.234:983"
Dec  1 14:52:13 unRaid  rpc.mountd[12585]: v4.0 client attached: 0xcde37f9d638883ac from "192.168.50.234:738"
Dec  1 14:53:45 unRaid  rpc.mountd[12585]: v4.0 client detached: 0xcde37f9d638883ac from "192.168.50.234:738"
Dec  1 14:58:51 unRaid  rpc.mountd[12585]: v4.0 client attached: 0xcde37f9f638883ac from "192.168.50.234:700"

The config on the NAS :

and the config on HAOS :

shell_command:
  mount_smb_frigate: mkdir -p /media/frigate;mount -t nfs4 192.168.50.222:/camera/frigate /media/frigate

When I try to check the folder mapped on HAOS I dont see it. How can I troubleshoot ?

i have same problem, can you fix it?

Hello,

  1. Make share NFS on your NAS
  2. It’s very important to check if your NAS system allow nfs share to your homeassistant IP
  3. it very important to create an automation to map the nfs share like this :
alias: Mount myNAS share
description: ""
trigger:
  - platform: homeassistant
    event: start
condition: []
action:
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - service: shell_command.mount_nfs
    data: {}
mode: single

Search on unRaid documentation/forum if you can’t make work the nfs share