Jump to content

How to Mount NFS share on Raspberry Pi

From wiki.oeser.name
Revision as of 19:46, 27 September 2016 by Udo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

First, you need a server that can use the Network File System (NFS). Let's assume you have a server named adelaide at 192.168.222.34 and it has a share called public that you want to mount at /public on your Pi.

First, install the necessary packages. I use aptitude, but you can use apt-get instead if you prefer; just put apt-get where you see aptitude:

sudo aptitude install nfs-common portmap

(nfs-common may already be installed, but this will ensure that it installs if it isn't already)

On the current version of Raspbian, rpcbind (part of the portmap package) does not start by default. This is presumably done to control memory consumption on our small systems. However, it isn't very big and we need it to make an NFS mount. To enable it manually, so we can mount our directory immediately:

sudo service rpcbind start

To make rpcbind start automatically at boot:

sudo update-rc.d rpcbind enable

Now, let's mount our share:

Make a directory for your mount. I want mine at /public, so:

mkdir /public

Mount manually to test (remember, my server is adelaide at 192.168.222.34 and the share is public):

mount -t nfs 192.168.222.34:/public /public

(my server share path) (where I want it mounted locally)

Now, to make it permanent, you need to edit /etc/fstab to make the directory mount at boot. I added a line to the end of /etc/fstab:

192.168.222.34:/public /public nfs rsize=8192,wsize=8192,timeo=14,intr 0 0

The rsize and wsize entries are not strictly necessary but I find they give me some extra speed. There are ways you can refer to your server by name instead of by its IP address like we did above. Have a look at /etc/hosts for a starting point. The rest is left as an exercise for the reader.

Hinweis

  1. Scheint Probleme mit WLAN-Reconnect am Raspberry Pi einrichten zu machen!!
  2. Bei ausgeschaltetem NAS kann mit folgendem Eintrag in der fstab nicht gebootet werden. (hängt beim mounten des NFS share)
192.168.178.5:/multimedia /multimedia  nfs     defaults,_netdev,ro     0     0