Sunday, 24 February 2013

Connecting a NAS drive to the Raspberry PI

One small limitation of the Raspberry PI is the limited amount of storage - just the size of the SD card. A simple solution is to use some external storage on the network. In my case this would be my NAS box which is already on my network and is being used by all the family. A quick search with Google found a nice explanation of how to achieve this at www.stuffaboutcode.com.

As I am using the latest Raspbian I did not need to install Samba or the cif-utils. The only issue I had with these instructions was I could not get it to work using the name of my NAS box, I had to use its IP address. So I changed //myNAS/myShare to //192.168.x.x/myShare. This is not a problem for me as I have a fixed IP address for my NAS box.

The text you add to the fstab file has the following meaning
//myNAS/myShare - this is the name of your NAS or its IP address followed by the name of the directory on the NAS you want to mount.
/home/pi/myNAS/myShare - this is the directory where you want you NAS to appear. It must exist.
cifs - specifies the type of connection used to access the remote NAS
username= ,password= - the username and password of someone with access to the NAS.
workgroup= - the name of your workgroup
users,auto - not sure what they mean - need to do some more research
user_xattr - enable extended attributes

One thing I did do was add file_mode=0777,dir_mode=0777 after the workgroup as without them I could only read the files. If you want to write to files and create directories you need to add these.

The one big issue with this method is that your username and password for your network share is stored in a simple text file. This is acceptable to me, but may not be for you. There is a link in the instructions that gives another more secure method of mounting an external NAS.

So I now have access to my network storage from the Raspberry PI.

No comments:

Post a Comment