element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Sci Fi Your Pi
  • Challenges & Projects
  • Design Challenges
  • Sci Fi Your Pi
  • More
  • Cancel
Sci Fi Your Pi
Blog Meditech: Raspian NFS sharing
  • Blog
  • Forum
  • Documents
  • Files
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: balearicdynamics
  • Date Created: 13 May 2015 8:12 AM Date Created
  • Views 563 views
  • Likes 2 likes
  • Comments 0 comments
  • meditech_project
  • portmap
  • linux_sharing
  • nfs_sharing
  • raspian
  • nfs_client
  • raspberry-pi
  • sci_fi_your_pi
  • nfs_server
  • remote_mount
Related
Recommended

Meditech: Raspian NFS sharing

balearicdynamics
balearicdynamics
13 May 2015

Introduction

Instead of using the samba protocol, that is more resource consuming and is needed only when the network files should be shared including Windows machines or other desktops or anyway for some specific needs, a better solution to share folders between several linux machines is through the NFS file system.

 

Server install and setting

Installing the server side on raspian should be take in account a couple of issues that affect this Debian distro. First of all we have two options to install the server: nfs-server and nfs-kernel-server but only the second is well working in this Debian distro without issues. Debian documentation site only says that this is strongly suggested on the most recent distributions The problem is that this choice should be warned because also the other NFS server alternative installs on raspian without problem.


Installation

So we proceed installing the NFS server, the NFS common utilities and the portmapper:


 

$>sudo apt-get install nfs-kernel-server nfs-common portmap

 


Note: the portmap package (port mapping service) must be installed but it is probably already present on the system; it depends on what other packages you have previously installed in your Raspberry. So don't worry if after the installation you see that the package is already installed and if you read that there is a problem starting the nfs server.


Configuration

After the packages installation has been finished we should configure the NFS server instructing how to share the folders that will be mounted by the remote linux machines, editing the exports file

 

$>sudo nano /etc/exports

 

Every folder that should be shared with the NFS clients should be listed in this configuration file. The following configuration line is related to the case we are managing; for further details on the exports conifguration file syntax read the exports NFS configuration documentation.

 

/home/stream xxx.xxx.xxx.xxx/0(rw,sync,no_subtree_check,no_root_squash)

 

Despite what I have found on the Internet in many place It is mandatory to specify the NFS server IP and the subnet /0 (for the case of a single device sharing a folder).

 

Restart and fine tuning

At this point, we should restart the NFS service with the command

 

$>sudo service nfs-kernel-server restart

 

Surprisingly the server seems unable to restart showing a message like the response listed below

 

$>sudo service nfs-kernel-server restart
[ ok ] Stopping NFS kernel daemon: mountd nfsd.
[ ok ] Unexporting directories for NFS kernel daemon....
[ ok ]   Exporting directories for NFS kernel daemon....
[....] Starting NFS kernel daemon: nfsd
[warn] Not starting: portmapper is not running ... (warning).

Showing the RPC call status with the command

 

$> rpcinfo -p

 

we see something like the following:

 

<br>rpcinfo: can't contact portmapper: RPC: Remote system error - No such file or directory

 

This occurs because of the issue mentioned above. The port mapping service is correctly installed on the system but seems that raspian is not enabled to start it by default during the reboot. The workaround to solve this issue is to explicitly add the binding of the port mapping to the boot sequence startup via rc.d configuration with the following command:

 

$>sudo update-rc.d rpcbind enable && sudo update-rc.d nfs-common enable

 

At this point after the reboot the system works correctly. Test restarting the NFS service after a reboot

 

$>sudo  /etc/init.d/nfs-kernel-server restart

 

to see the correct restart sequence notifications on the terminal

 

pi@RPIslave2 ~ $ sudo /etc/init.d/nfs-kernel-server restart

[ ok ] Stopping NFS kernel daemon: mountd nfsd.

[ ok ] Unexporting directories for NFS kernel daemon....

[ ok ] Exporting directories for NFS kernel daemon....

[....] Starting NFS kernel daemon: nfsdrpc.nfsd: address family inet6 not supported by protocol TCP

mountdrpc.mountd: svc_tli_create: could not open connection for udp6

rpc.mountd: svc_tli_create: could not open connection for tcp6

rpc.mountd: svc_tli_create: could not open connection for udp6

rpc.mountd: svc_tli_create: could not open connection for tcp6

rpc.mountd: svc_tli_create: could not open connection for udp6

rpc.mountd: svc_tli_create: could not open connection for tcp6


Take in account that he warnings related to the tcp6 and udp6 depends on the use of the IPV4 only and not the IPV6 protocol in the network, so it doesn't affect the server functionality. For permanent mounting the mount parameters should be added to the /etc/fstab file of the client computer.


Client installation and setting

Client installation is almost simple as we only need to install the portmapper and the nfs client.

 

Install the packages

 

$>sudo apt-get install nfs-common

 

Then create the folder where the remote mount should be mapped

 

$>sudo mkdir -p <client mount folder>

 

Now mount the remote folder (with the full path) on the client local folder on the client machine.

 

$>sudo mount xxx.xxx.xxx.xxx:/<server full path shared folder> <client mount folder>

 

That's all!

 

With the mount command you will see an output like this (showing my specific case as an example)

 

$>mount
/dev/root on / type ext4 (rw,noatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=437856k,nr_inodes=109464,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=88432k,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=176860k)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
/dev/mmcblk0p5 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
/dev/mmcblk0p3 on /media/SETTINGS_ type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks)
192.168.5.3:/home/pi/stream on /mnt/stream type nfs4 (rw,relatime,vers=4.0,rsize=65536,wsize=65536,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.5.2,local_lock=none,addr=192.168.5.3)

Where the last line shows the remote /home/stream folder mounted on the local /mnt/stream folder You will see also the mounted folder, that is as a matter of fact is very similar to a removable media with the disk free df command as shown in the example below.

 

$> df -h
Filesystem                   Size  Used Avail Use% Mounted on
rootfs                       877G  4.3G  828G   1% /
/dev/root                    877G  4.3G  828G   1% /
devtmpfs                     428M     0  428M   0% /dev
tmpfs                         87M  304K   87M   1% /run
tmpfs                        5.0M     0  5.0M   0% /run/lock
tmpfs                        173M     0  173M   0% /run/shm
/dev/mmcblk0p5                60M   15M   45M  25% /boot
/dev/mmcblk0p3                27M  442K   25M   2% /media/SETTINGS_
192.168.5.3:/home/pi/stream  5.8G  2.6G  2.9G  48% /mnt/stream

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube