book collections email follower instructable user
Picture of Turn Raspberry Pi into a Network File System version 4 (NFSv4) server

Introduction

Network FIle System(NFS) can simultaneously run in version 2, 3, 4. NFS version 4(NFSv4) has several improvements over the NFSv2 and NFSv3. The improvements I like most are:

  • NFSv4 makes configuring firewall simple because NFSv4 uses only one port (default to 2049) while NFSv2 and NFSv3 use 4 randomly changing ports
  • NFSv4 provides strong security with the implementation of Kerberos while NFSv2 and NFSv3 don't

In my home network, all the computers are installed with Linux OS that supports NFSv4. Therefore, it is advantageous to configure NFS server to be ONLY operating in version 4 and disable NFSv2 and NFSv3.

After completing this instructable, you might be interested in learning how to use the automounter.

Scope

This instructable will show:

  • How to install NFSv4 server
  • How to enable configure NFSv4 server
  • How to disable NFSv2 and NFSv3
  • How to run NFSv4 server
  • How to test NFSv4 server

This instructable will NOT show:

My system specification

Linux rpipro 3.18.7+ #755 PREEMPT Thu Feb 12 17:14:31 GMT 2015 armv6l GNU/Linux

Step 1: Install NFS

Open terminal emulator in Raspberry Pi

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

Install NFS

sudo apt-get install nfs-common nfs-kernel-server
ArkadiuszO3 years ago

I make nfs server and client on two raspberry pi's 3 (raspbian jessie) when I made file (server side) on my shared place (/home/nfs) I can't see them on client side when I use x window file menager, but when I use terminal, go-> /home/nfs then "ls" I can see that the flie exist. From the other side, when I made file on client /home/nfs appear immediately on server /home/nfs. I'm using VNC to connect with both rpi's. Please help me figure out what can be wrong ? there is any chance that is issue with VNC ?

DmitryU23 years ago

When trying to install nfs-kernel-server on Wheezy on the RPI2 I've got an error:

The following packages have unmet dependencies:

nfs-kernel-server : Depends: libtirpc1 but it is not going to be installed

Depends: nfs-common (= 1:1.2.6-4) but it is not going to be installed

E: Unable to correct problems, you have held broken packages.

mirza irwan osman (author)  DmitryU23 years ago

Hi Dmitry

I have no problem such as yours on my RPI 2.

I did the following:

sudo apt-get update

sudo apt-get upgrade

sudo apt-get dist-upgrade

sudo apt-get install nfs-common nfs-kernel-server

Maybe you can try the above.

Best Regards.

I did all above but still have got:

The following packages have unmet dependencies:

libtirpc1 : Breaks: nfs-kernel-server (< 1:1.2.8-7) but 1:1.2.6-4 is to be installed

nfs-common : Breaks: nfs-kernel-server (< 1:1.2.8-6~) but 1:1.2.6-4 is to be installed

nfs-kernel-server : Depends: nfs-common (= 1:1.2.6-4) but 1:1.2.8-9 is to be installed

E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

RobL57 DmitryU23 years ago

enter this:

sudo apt-get -f install

AdamB1423 years ago

I don't get any of the text output after sudo service nfs-kernel-server start. The cursor blinks for half a second and then I get the prompt back. No [ ok ] etc. Have I done something wrong?

NoelP123 years ago

Good info. Using Raspian Jessie, December 29, 2015. Found the changes to /etc/default/nfs-kernel-server had to be manually entered to make the nfs server work on start up. Neither NEED_STATD nor NEED_IDMAPD were in the new configuration file. nfs-kernel-server would start from the command line but would not start on boot up with out those changes. Thanks.

DmitryU23 years ago

This issue reported here as well:

https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=110091&p=822196