If for some reason you find problems with broken Samba sharing on Raspbian, or just want something faster and more transparent, there is the NFS alternative — which, at least for me, is cooler than Samba. To access it from Windows is a bit more involved, and I won’t cover it on this quickie, as I’m really only needing to access it remotely from another Linux machine anyway.
So, it was a bit tricky to get it running and mounting automatically, but after spending some time on Google and experimenting/resuming a lot of different random forum suggestions, I finally got it working nicely and also mounting automatically. Here I try to resume it in just a few steps (first on a Rasberry terminal):
sudo apt-get install nfs-kernel-server
Then open /etc/exports for editing:
sudo nano /etc/exports
And add this line to map the usb hdd that is there (you need to change the path to your mounted usb drive, of course):
The first path is where I’ve an external usb hdd mounted on this Raspberry, and the mask after it allows all machines coming from 192.168.1.* (my internal network) to read from it normally through the network. I decided to mount it as read-only (ro flag). You should adapt these to your case.
To overcome the warning “NFS Server: Not starting: portmapper is not running” that happens on Raspbian, I needed to use this:
sudo update-rc.d rpcbind enable && sudo update-rc.d nfs-common enable sudo service rpcbind restart sudo /etc/init.d/nfs-kernel-server restart
instead of just restarting NFS. Check if the NFS server is properly running with this:
sudo /etc/init.d/nfs-kernel-server status
Ok, so if it’s now running properly on Raspbian, go to the Desktop Linux from where you want to access that Raspberry share, and install the common client:
sudo apt-get install nfs-common
Edit fstab to add the share on that machine:
sudo nano /etc/fstab
Then add the map to the share:
# maps to raspberry's music nfs 192.168.1.2:/mnt/media01/Public /media/Public nfs auto,user,ro,hard,intr 0 0
192.168.1.2 is my Raspberry ip, you should change that. Also do not forget to create the mounting point (/media/Public) locally.
This specific combination of Client and Server configuration should made it automatically mount the shared nfs drive for me at boot time. If you don’t want to reboot right now, you can mount manually with
sudo mount -a
In my case, I never turn the Raspberry off, so it’s always available. If your Raspberry is not going to be online 24/7, you may prefer to remove the “auto” flag from the fstab line, then always use the mount -a when you want to access it on a given session.
From the many places I visited, these were the more important for me to find a successful configuration:
1 – https://askubuntu.com/a/7124
2 – https://raspberrypi.stackexchange.com/questions/10403/nfs-server-not-starting-portmapper-is-not-running
3 – https://forum.manjaro.org/t/nfs-doent-mount-on-startup-with-kernel-4-13/34762/17