Accessing a network folder on RPi2
Another thing that should have been trivial, but was not.
I had recently configured a simple shared folder for backing up pictures from our phones using the Android app ‘SyncMe’. Very convenient, simple to setup.
It would be great to backup my code endeavors up until now likewise on the shared folder. When I tried to set that up, there was some confusion on what the mounting (connection of the network drive or folder to a local folder) instructions were, and there are several methods depending on your needs. So here is how I end up doing it, in case you need it:
Manual approach
By hand, for \\10.0.0.1\code, I ended up using:
> mkdir /mnt/code > sudo mount -t cifs -o guest,sec=ntlmv2 //192.168.0.1/code /mnt/code
The tricks here are:
the type of mount has changed for his type of folders, it used to be smbfs before 2008 or so, and now it is cifs
for this shared folders on a USB hard drive attached to our home router, it required adding the ‘sec=nmtlv2′ option to prevent the error:
mount error(13): Permission denied
Semi automatic approach
The instruction given in this thread were helpful , and need to be tweaked with the above:
after doing the manual approach above and creating the folder, it is time to edit /etc/fstab
> sudo nano /etc/fstab
In there add the line:
//192.168.0.1/code /mnt/code cifs guest,sec=ntlmv2,uid=1000,gid=1000 0 0
This is it. After this anytime you need this mount you can get it via:
> sudo mount -a
Let’s even add convenient access from within /home/pi by linking the mounted folder to /home/pi/code via a symbolic link, assuming we are in /home/pi:
> ln -s /mnt/code-on-network code
To undo it if needed (from /home/pi):
> unlink code
Disclaimer:
This was an example for backup or file transfer purposes, not a genuine setup of a code repository. I have not settled yet on the latter topic, but will be looking in setting up something like git on my local network.
In this day and age, developers know the value of incremental change, and history of changes. Shared folders are just not enough for anything beyond 16h of coding effort.
Well, let’s enjoy our shared folders on the Raspberry pi!














