TransWikia.com

Can't mount Raspberry Pi NFS Server

Raspberry Pi Asked on January 6, 2022

I am trying to set up my pi3 running raspbian as an NFS server. I’ve followed these instructions: http://www.htpcguides.com/configure-nfs-server-and-nfs-client-raspberry-pi/

In /etc/exports I have the line:

/mnt/Shared 192.168.1.0/24 *(rw,sync)

Which I hope means that the folder at /mnt/Shared (which is a directory on an external hard drive) is available for reading and writing by all machines using a local IP address. Then I do exportfs:

$ sudo exportfs
/mnt/Shared    192.168.1.0/24
/mnt/Shared    <world>

Then, on my laptop, which is running Ubuntu, I follow the client side instructions from the same site, but the mount command fails after a long wait:

$ sudo mount 192.168.1.105:/mnt/Shared /mnt/nfs
mount.nfs: Connection timed out

If I try that verbose it looks like this:

sudo mount -v 192.168.1.105:/mnt/Shared /mnt/nfs/
mount.nfs: timeout set for Sat Feb 18 21:52:14 2017
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.105,clientaddr=192.168.1.109'
mount.nfs: mount(2): Connection refused
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.105,clientaddr=192.168.1.109'
mount.nfs: mount(2): Connection refused
...
<repeated several times>
...
mount.nfs: Connection timed out

Has anyone any ideas of how to make it work? I don’t think the problem is with the external hard drive, it appears to be mounted correctly, and I had the same issues trying to share a local directory.

3 Answers

Tell reboot to wait for the network to be available. It’s on raspi-config in the advanced section iirc

Answered by JimS-CLT on January 6, 2022

On the RPi NFS Server (The Media Server)

sudo /etc/init.d/rpcbind restart
sudo /etc/init.d/nfs-kernel-server restart

On the RPi NFS Client (My Plex Server)

sudo mount 192.168.1.105:/mnt/Shared /mnt/nfs

This worked for me.

And I had to mount my drives including the uid/gid in /etc/fstap because in my case chown does not work when the drive is mounted by root. Maybe someone can give me a tip for that.

Answered by Dods on January 6, 2022

First I would make the following bash script and call it delay:

#!/bin/bash
# $1:delay time(s)
# $2:command
# example:
#    delay 10 "conky -d"

sleep $1
exec $2

Then I would make it executable

chmod a+x delay

You could put the command from your comments:

delay 60 "sudo systemctl restart nfs-kernel-server"

at the end of the rc.local file in /etc/init.d/ to have it run 60 seconds after every time the Pi boots up

Answered by Mohammad Ali on January 6, 2022

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP