1

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?

Boris
  • 4,932
Bluebill
  • 145

2 Answers2

2

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
    

    with:
    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

Boris
  • 4,932
  • Boris, thank you for the detailed response. Is it possible to mount the share to the music directory in my home directory ( ~/music)? Or is there a reason you mount the shares to /media. – Bluebill Apr 29 '12 at 18:56
  • Bluebill, no /media/sharefolder is an example, you can define an other path like /home/bluebill/music. – Boris Apr 30 '12 at 07:40
  • Personnaly I created symlinks on my laptop that point through autofs nfs mount points of my tower like this: ln -s /net/MY_Tower/var/autofs/removable/usbDataBackups/ tower_backups – Philippe Gachoud Dec 16 '14 at 12:15
1

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.

Fih
  • 1,933
  • Fih, I am leaning towards creating an sh script as I can already mount them manually to /media/share_name. – Bluebill Apr 29 '12 at 18:57