What about if you want to be able to access that network drive every time your Pi is turned on?  Of course, that is possible.  I am assuming that your Network Attached Storage (or NAS) is Linux-based, or is sharing NFS storage.  Most are – all three of my NAS drives, all from different manufacturers, are Linux-based.


Making a Mount Point

To ‘mount’ a network storage folder on your Pi, you must first create a folder onto which you will ‘mount’ the external network drive. This is the location on your Pi where you will find all the files from your network storage.  For example, go to your home folder and create a new folder with:

cd ~
mkdir MyNAS

This directory can be anywhere on your Pi, and is often in the /media or /mnt directories.

Turning on File Locking

Being a secure operating system, Linux has the concept of ‘locking’ files when they are being accessed by someone.  You are able to mount shared folders without this facility, but I recommend that you use it to safeguard your files. You need to turn on the ‘rpcbind’ service, which is not on by default.  Do this with:

sudo update-rc.d rpcbind enable

Preparing your NAS

All Network Attached Storage drives will have some sort of security built in. This means that it will be able to limit access to files and folders within your home network. If you want your Raspberry Pi to access any files or folders on the NAS then you will have to ‘open’ access to those files and folders. How you do this will depend on the NAS you have. I have three here at home, and each one is different. Depending on what you are sharing, the way you share those files and folders will be different. If, for example, you want to share your music of videos, then you may feel that it’s okay for anyone on your home network to see them. If you have files that you don’t want others to see, then you need to share those only with certain user accounts.

What I’m going to assume here is that you are going to either share music/video with everyone, or any files that your Pi is going to create are okay for all to see.  This means that you need to make a folder and all folders and files under it either ‘public’ or accessible by a ‘guest’ account. How you do this, as I say, is dependent on your NAS.

Defining the Mount

There is a file in the /etc folder called fstab which defines the ‘file system table’.  In other words, it tells the Pi what storage should be mounted every time your Raspberry Pi boots.  You can include your network drive in this file. But before you edit it, back it up as it is quite easy to mess up your Pi by inadvertently changing something you shouldn’t in this file.

sudo cp /etc/fstab /etc/fstab.backup

This is an important step.  While creating this tutorial I edited the fstab on my IQaudIO Volumio Pi2 which is permanently connected to my NAS that shares my music files.  Unfortunately I rebooted it with an error in the fstab file, which stopped it from booting correctly. For many, this would be a disaster, but fortunately I was able to take the microSD card from this Pi and add it as an external drive on my beta-Pi2 and was able to restore my backup fstab file! The day was saved.

Now we can edit fstab:

sudo nano /etc/fstab

And add a line at the end of the file:

// /home/pi/MyNAS nfs default 0 0

As usual with nano, press Ctrl+X to exit, responding ‘Y’ to whether you want to save, and press ‘Return’.

The folder is not automatically mounted. You have to tell your Pi to read the fstab file and mount the drives.  Do this with:

sudo mount -a

which will read the fstab file and mount any drives that are not already mounted.

If all has gone well, you should now be able to go to the directory and see what files are there.

cd ~/MyNAS

Which will list all the files and folders that you have shared.  If, after a bit of experimenting, you find that something just doesn’t work, remember to restore your last fstab file before you reboot and try again by doing:

sudo cp /etc/fstab.backup /etc/fstab


Hopefully you should now have access to a shared folder on your NAS. Using these instructions I have my ‘Volumio OS’ based Pi (with IQaudIO DAC and Amp) connected to my QNAP NAS that serves my music. I have another Pi that is my XBMC client that connects to another NAS for my video files.

While I cannot answer all questions, I would like to hear about your experiences with shared network

Identify the drive,

sudo blkid


# /dev/sda1: LABEL="ELEMENTS" UUID="E033-1109" TYPE="vfat"

in this case it's /dev/sda1 with a UUID of E033-1109 and type FAT:


Create a directory it will be mounted at:

sudo mkdir /mnt/usbel  

Own it:

sudo chown -R pi:pi /mnt/usbel 


  1. If you drive is in FAT32

You could manually mount it:

sudo mount -o uid=pi -o gid=pi -t vfat /dev/sda1 /mnt/usbdata  

But let’s auto-mount it instead:

sudo nano /etc/fstab 

add the line to the end of the file (you can copy and paste this line)

/dev/sda1        /home/pi/usbdrv       vfat    uid=pi,gid=pi,umask=0022,sync,auto,nosuid,rw,nouser 0   0

  1. If your drive is NTFS

Install ntfs-3g

sudo apt-get install ntfs-3g

You could manually mount it:

sudo mount -o uid=pi -o gid=pi -t ntfs-3g /dev/sda1 /mnt/usbdata  

you can auto mount if:

sudo nano /etc/fstab

Then insert this line below

/dev/sda1        /home/pi/usbdrv       ntfs-3g    uid=pi,gid=pi,umask=0022,sync,auto,nosuid,rw,nouser 0   0

Important: this is 1 line, not broken up over two lines  (the Instructable is doing weird things to the formatting).

CTR + X, then Y, then Enter/Return to save your change.

What this does is to map the /dev/sda1 deviceany thumb USB drive to the usbdrv directory.

Then restart.

sudo reboot

In case you want to unmout:

sudo umount /dev/sda1