Ubuntu: Mount NFS share as a shortcut


I recently purchased a Netgear ReadyNas and have a question about mounting an NFS volume. Firstly I know how to mount the share in fstab. There is a lot of information around that describes how to do that. I really don't want to do that.

What I want to do is have a shortcut or launcher that I can execute which will mount the nfs share for me (for example mounting it to ~/music). When I plug in a usb drive xubuntu automatically puts a drive icon shortcut on my desktop and allows me to 'eject'. Is this possible? Does it make sense?

I am using xubuntu 11.10.

I have been doing research to solve this problem and I have come up with two possibilities:

1) Create a shell script or

2) AutoFS.

I am not sure which is better. I am more comfortable with shell scripting than AutoFS. The problem with the shell scripting is that I'll need sudo permissions. What I have read about AutoFS it might be the best solution. Is there a way to setup AutoFS so that I can keep the configuration files within the users home folder?


I'm using Autofs for my NFS network, see this answer.

Note that :
autofs is a program for automatically mounting directories on an as-needed basis. Auto-mounts are mounted only as they are accessed, and are unmounted after a period of inactivity. Because of this, automounting NFS/Samba shares conserves bandwidth and offers better overall performance compared to static mounts via fstab.

I've used an admin account to configure it, and I use it every day with a normal account.

1st you need to setup your Netgear ReadyNas to act like a server. ( I can not describe this part).

Then I suppose you can setup Autofs like this:

  • install Autofs

    $ sudo apt-get install autofs  
  • create the folder used to mount the connection with your Netgear ReadyNas

    $ sudo mkdir /media/shareFolder  
  • set autofs to automatically mount this folder,
    in /etc/auto.master add this line:

    /media/shareFolder /etc/auto.nfs --ghost, --timeout=60  

    in /etc/auto.nfs add this line

    Netgear -fstype=nfs,rw,intr,uid=1001,guid=1001   192.168.1.?:/home/something  

    192.168.1.? is the address of your Netgear ReadyNas
    /home/something is the folder shared on your Netgear ReadyNas
    1001 is the normal user (without admin privilege) and group ID. To find it $ id {your normal logon}

Result should be that your /home/something from your Netgear ReadyNas is mounted in /media/shareFolder/Netgear


Just create your own script nfsmount.sh and then create a shortcut to it. Tip: Mount it to /media/something not to /mnt if mount to /media it will be displayed in nautilus and launcher. And then create a link from /media/nfsmusic to /home/hhlp/music.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »