Guide - Setting up a NFS Share
#1
Information 
Preface



This quick and simple guide will show how to create a NFS Share using your Rock64. NFS has a few advantages over SMB, if you know your network well and will use it with linux clients. Apart from marginally faster file transfers, NFS allows you to retain Unix File permissions. 



Prerequisites


ROCK64 board running Debian or Ubuntu, connected to the local network

Access to terminal, either locally or via SSH

Some basic understanding of using the linux terminal: Howtogeek

Suggested: A basic comprehension of linux file permissions



____________________


As always before installing any software in linux, it is always good practise to ensure that your software is up to date: 


Code:
sudo apt update && sudo apt upgrade
 
After ensuring your software is up to date, you will need to install the NFS kernel server. Some distros have this installed by default, but there is no harm in running the command regardless, if it isnt installed, it will give you the option to install it: 

Code:
sudo apt install nfs-kernel-server


[Image: wl0jtOz.png]

After the server is installed, now its time to edit the configuration file, to add a share definition. 

You'll need to edit the exports file: 

Code:
sudoedit /etc/exports

You can add a new share definition in the following format:

Share-location Network-Access Share-options

Here are mine. The location looks different to past tutorials because I accidentally formatted my flash drive: 


Code:
/media/SDCZ45-016G/RockNFS 192.168.1.*(rw,sync,insecure,no_root_squash,no_subtree_check)
  
The next field (192.168.1.*) simply defines what part of your local area network is allowed to access the share. I've configured it so that any computer with the IP address from 192.168.1.1 to 192.168.1.254 can access it. You can allow any (local) IP address to access the share using "*.*" or you can limit it to a specific IP address of a computer. 

The last options specify how the server should treat the share. If you'd like to read up more on their effects: https://linux.die.net/man/5/exports


This is how it would look like before you save and exit the file: 

[Image: NwOrMV8.png?1]


After you're done, restart the service: 

Code:
sudo /etc/init.d/nfs-kernel-server restart

or 

Code:
sudo service nfs-kernel-server restart

Will do the job. 


The server will now be up and running! 



____________________

On the client's side, you'll need to make sure that you've got the NFS client stuff: 
 

Code:
sudo apt install nfs-common


After that, you can probe the server from the client PC to test/see if it hosts accessible NFS Shares. To do that, we use the showmount command, followed by an argument and the address of the server: 

Code:
showmount -e rock64.local


Either IP address or hostname should work: 

[Image: 8PkwEZO.png]

The "e" arguments tells the showmount command to show the export list from the server. 


Next, you'll need to mount the share. I did this in my Home directory, making a new test folder for it. The mount command could be invoked now, and you can mount the NFS share to the new directory that you've made. The "-vv" means its verbose; it prints out status and progress. 


Code:
sudo mount -t nfs rock64.local:/media/SDCZ45-016G/RockNFS nfstest/ -vv

The command you use will be different based on your host and client. When typing it out, after putting down the hostname (rock64.local:/), I was able to use tab completion to complete the rest of the location without manually typing it out. Simply hit the "tab" key, and it should autocomplete the rest of the path. 

[Image: ZAb7oj1.png]


You can make a test file in the folder, either using the terminal, or a graphical file manager. I made a test file on my client using the "touch" command. 

Then to confirm that the changes are seen on the client side, I SSH'ed back into my server, navigated to the share location, and listed confirmed that the new file had been created: 

[Image: ZAVQvSa.png]

You should now know how to whip up a NFS share on the Rock64 board, and mount/access it from a client OS. If you wish to permanently mount the NFS Share to your client, I would recommend doing it via fstab: 

https://askubuntu.com/questions/7117/which-to-use-nfs-or-samba 
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Beginners Guide: Migrating to SSD rontant 17 9,383 05-24-2019, 12:23 PM
Last Post: thatchunkylad1989
  Step by step guide PXE diskless configuration. burglar_ot 12 3,603 04-08-2019, 08:27 AM
Last Post: burglar_ot
Thumbs Up A guide for how I made RetroPie, RetroArch, and EmulationStation Work on the Rock64 Mrfixit2001 4 4,795 12-17-2018, 03:52 AM
Last Post: va88
  Guide - XRDP - Debian Stretch / Ubuntu Xenial / OMV S3phi40T 3 6,055 05-05-2018, 06:08 AM
Last Post: S3phi40T
Information Guide - Raid Array (Raid 0) Ptheven 0 1,519 10-07-2017, 09:22 AM
Last Post: Ptheven
  Guide - Setting up a SMB(Windows) file server Ptheven 0 2,183 08-21-2017, 08:54 AM
Last Post: Ptheven
Information Beginners Guide: Locating your board, connecting to it. Ptheven 5 4,866 08-21-2017, 04:12 AM
Last Post: Ptheven
Information Beginners Guide: Adding USB Storage, Linux Formatting and Permissions Ptheven 3 3,405 08-16-2017, 01:19 AM
Last Post: Ptheven

Forum Jump:


Users browsing this thread: 1 Guest(s)