A blog all about Linux and Linux software.
A blog all about Linux and Linux software.

Setting up a raspberry pi NAS using NFS

The post you are about to read is a continuation of the post below.


I recomend you read how to set up a R-pi web server first since i will not cover the basic set up in this guide. I also recomend you read the post


This is so you know about file systems before you start your NFS server.

This post will use NFS or network file system I will make another tutorial for samba


What is NFS

NFS is a file system developed by sun microsystems to access files from a networked location as if the files where in a local directory. NFS has excellent suport for linux, good support for OSX. Windows has no built in support for NFS and you need professional or ultimate to download it from microsoft.


Setting up NFS

First of all ssh into your pi

Next you need to install the program nfs-kernel-server with the command

<sudo apt-get install nfs-kernel-server>

Accept the other programs apt will try to install and wait until it has finished installing. You may be a bit worried from the message you got that roughly reads [warn]Nfs not starting no exports[warn] but all that means is we haven't set up any NFS shares yet


Next you need to plug a usb hdd into your pi and type <df -h> which will tell you the mountpoint of your hdd probally /dev/sda1 but check anyway.

Now make the directory to permanently mount your hdd for example <sudo mkdir /media/hdd1>


Then type <sudo nano /etc/fstab> and paste in the line

/addres/df-h/told/you /addres/to/your/hdd file format you chose defaults,noatime 0 1


Then reboot and you should have your hdd mounted to the name you want

You now need to mount your hdd with <sudo mount /address/to/your/hdd>

make some directories for your files with mkdir. For example

<sudo mkdir /media/hdd1/Music>

<sudo mkdir /media/hdd1/Movies>

<sudo mkdir /media/hdd1/Documents>

Next you have to create you /etc/exports file with the command

<sudo nano /etc/exports> then paste and edit

/media/hdd1/Documents *(rw,sync,no_root_squash)

/media/hdd1/Music *(rw,sync,no_root_squash)

/media/hdd1/Movies *(rw,sync,no_root_squash)

once you have done that press ctrl x to exit and type <sudo /etc/init.d/rpcbind start> followed by <sudo service nfs-kernel-server restart>.


Your pi should report that NFShas succesully started and you can continue to installing nfs on Linux but OSX has it preinstalled

On linux

You need to install the package nfs-common with your distros package manager. for example <sudo apt-get install nfs-common> for debian/ubuntu based distros or <sudo pacman -S nfs-common> for arch


Finishing off

Firstly you should make some new empty directories on your main pc with the command sudo mkdir. You should make as many as you made for the pi earlier.


Now you mount them with the command <sudo nano /etc/fstab> you need to add the line

ip-address of your pi:/media/hdd1/Documents /home/ocb/Documents nfs auto 0 0


editing it for your system and pasting it in the amount of folders you made.

Finally i would like it if you told me if i have made any mistakes or if you liked this post.

Share This Story

Get our newsletter