Author Topic: [SOLVED] Using autofs or amd to automount NFS shares  (Read 1660 times)

Offline tilaloz

  • Jr. Member
  • **
  • Posts: 25
[SOLVED] Using autofs or amd to automount NFS shares
« on: August 04, 2012, 11:26:38 PM »
I am trying to get an NFS share from my NAS to automount using either autofs or amd. I can mount it statically using /etc/fstab.

Code: [Select]
mybooklive:/nfs/Public /Public_nfs nfs user,rsize=8192,wsize=8192,exec,soft 0 0


but I would really like to get automounting working.

In all cases, I'm not getting any error messages and the service/daemon is running, I just can't seem to get them to mount

amd.conf is the default from the repo with the addition of
Code: [Select]
[ /public ]
map_name = amd.public
map_type = file
mount_type = nfs

amd.public is
Code: [Select]
/defaults opts:=rw;type:=nfs
Public rhost:=192.168.1.122;rfs:=/nfs/Public

I can verify that amd is running
Code: [Select]
/etc/init.d/amd status and
Code: [Select]
amq -m but it never mounts when
Code: [Select]
cd /public/Public
I also tried configuring autofs to automount by adding this to my auto.master

Code: [Select]
/misc -fstype=nfs,rw,soft,intr,nosuid,nodev,tcp,retry=10,rsize=8192,wsize=8192 192.168.1.122:/nfs/Public

I also tried indirect mapping with auto.misc with same behavior.
Code: [Select]
cd /misc/foobar comes back No such directory.

Thank you

« Last Edit: August 06, 2012, 09:19:59 PM by tilaloz »

Online muungwana

  • Hero Member
  • *****
  • Posts: 6269
Re: Using autofs or amd to automount NFS shares
« Reply #1 on: August 04, 2012, 11:41:09 PM »
what do you mean by "automount"?

do you mean you want the share to auto mount at boot time or when some event happen like when an attempt is made to access the share when the system is fully up?
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline tilaloz

  • Jr. Member
  • **
  • Posts: 25
Re: Using autofs or amd to automount NFS shares
« Reply #2 on: August 05, 2012, 06:53:20 AM »
I mean true automounting (read attempts trigger the mounting and the mounting times out) not static mounting that happens from /etc/fstab that is confusingly called auto if it happens at  boot. It seems like it should be a doable thing. Every *nix at my work has automounting homes using autofs.

I already have cifs mounts from the nas in the /etc/fstab (which this group graciously helped out with http://www.pclinuxos.com/forum/index.php?topic=96861.0) but that solution has some issues that I have never been able to resolve.

  • On both laptops the cifs mounts have to be done manually because wifi hasn't connected yet when rc.local runs. (My wife doesn't like running things from the command line)
  • There is an inexplicable issue with some executable running on files from the cifs mount. jhead, nedit, and configure scripts are the three recent issues that I have noticed. jhead and nedit claim that they can't access the files even though everything else can and configure scripts say they can't build an executable file on the mount.
  • Switching the /etc/fstab entries with NFS entries did not resolve the issue because the NFS mounts as root and then I can't access any of the files. The NAS doesn't give me access to /etc/exports or any NFS settings to match UIDs etc. So I would really like to be able to automount the drive on a access by access basis.

Online muungwana

  • Hero Member
  • *****
  • Posts: 6269
Re: Using autofs or amd to automount NFS shares
« Reply #3 on: August 05, 2012, 10:42:50 AM »

I have never handled NFS shares before and i dont remember seeing this kind of discussion here before.

Hope somebody else will come along and help you out, will follow the thread closely i predict a lot of wisdom will come out of thread.
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline tilaloz

  • Jr. Member
  • **
  • Posts: 25
Re: [SOLVED] Using autofs or amd to automount NFS shares
« Reply #4 on: August 06, 2012, 09:27:49 PM »
It is working now. There was an issue with my paths from me blindly following what was already there (auto.master refers to /etc/auto.misc but it is /etc/autofs/auto.misc).

There is a good set of instructions here, http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch29_:_Remote_Disk_Access_with_NFS#The_NFS_Automounter

/etc/autofs/auto.master I added this line for direct mapping (I'm pretty sure most of those flags aren't important but I tried lots of things and didn't back them all out.
Code: [Select]
/- file:/etc/autofs/auto.test -fstype=nfs,rw,intr,nosuid,nodev,tcp,retry=960,rsize=8192,wsize=8192
and created a file /etc/autofs/auto.test with the following
Code: [Select]
/Public mybooklive:/nfs/Public/
Just verify that autofs is running  with /etc/init.d/autofs status and I was on my way.

Offline Just17

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 11066
  • MLUs Forever!
Re: [SOLVED] Using autofs or amd to automount NFS shares
« Reply #5 on: August 07, 2012, 06:48:46 AM »
It would be of great use to see clear step by step instructions in the Tips & Tricks section of the forum for this.

I use NFS on the home LAN to share repositories and other directories from a PC to the others on the LAN.

Because of the high probability that not all PCs (and thus all shares) are not live at any time, I have been manually mounting the shares when required ... can be frustrating when I forget to mount one before attempting access.

So a PCLOS set up tute would be helpful, I believe.


MLUs rule the roost!

Linux XPS 3.4.48-pclos1.bfs  64 bit
Intel Core2 Quad CPU Q9450 @ 2.66GHz
4 GB RAM
MCP51 High Def Audio
GeForce GTX 550 Ti
PHILIPS  ‎DVD+-RW DVD8701
‎Logitech ‎BT Mini-Receiver
Afatech DTT

Offline Just17

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 11066
  • MLUs Forever!
Re: [SOLVED] Using autofs or amd to automount NFS shares
« Reply #6 on: August 12, 2012, 08:42:57 AM »
I am somewhat confused about the syntax of the required entries in the files, so maybe someone could enlighten me please?

I have a PC on the LAN which has a repository and this is shared via NFS, and I can mount it where I wish by adding an entry to fstab.

The fstab entry on the client machine would be something like this:

192.168.1.132:/media/1.5TB/32bit_Repository  /media/MyMirror  nfs  user,ro  0 0

So, if I wish that to be handled by autofs what would be the entries required and in what files?


I am looking .......  but not groking  :(

Help appreciated  ;)

MLUs rule the roost!

Linux XPS 3.4.48-pclos1.bfs  64 bit
Intel Core2 Quad CPU Q9450 @ 2.66GHz
4 GB RAM
MCP51 High Def Audio
GeForce GTX 550 Ti
PHILIPS  ‎DVD+-RW DVD8701
‎Logitech ‎BT Mini-Receiver
Afatech DTT

Offline Just17

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 11066
  • MLUs Forever!
Re: [SOLVED] Using autofs or amd to automount NFS shares
« Reply #7 on: August 15, 2012, 07:13:28 AM »
I ended up doing direct mount as tilaloz did .......  I could not get it to mount otherwise.



auto.master:
                             
Code: [Select]
/- file:/etc/autofs/auto.nfs   --timeout=30

auto.nfs:
                           
Code: [Select]
/nfs/MyMirror       192.168.1.132:/media/1.5TB/32bit_Repository/
MLUs rule the roost!

Linux XPS 3.4.48-pclos1.bfs  64 bit
Intel Core2 Quad CPU Q9450 @ 2.66GHz
4 GB RAM
MCP51 High Def Audio
GeForce GTX 550 Ti
PHILIPS  ‎DVD+-RW DVD8701
‎Logitech ‎BT Mini-Receiver
Afatech DTT

Offline tilaloz

  • Jr. Member
  • **
  • Posts: 25
Re: [SOLVED] Using autofs or amd to automount NFS shares
« Reply #8 on: August 28, 2012, 10:14:45 PM »
I've never written a tutorial before but I'm finally getting around to setting up my other boxes the same as one that motivated this post... so here it goes.

Motivation:
I want to use autofs to automount NFS shares. One advantage to automounting is some network drives may not be available all of the time including at boot (e.g., Network Attached Storage over wireless).

Assumption:
There is already a configured and working NFS server on your network. There are several tutorials for this and most NAS come pre-configured with NFS

1. Starting with a completely update to copy of PCLinuxOS, use synaptic to download the autofs package. This downloads the /etc/autofs/auto.master and associated files and setups up the autofs script in /etc/init.d/

2. Using the PCLinuxOS Control Center -> Network & Internet -> Hosts Definition: Map the desired hostname to the IP address of the NFS server.

3. Using the PCLinuxOS Control Center -> System -> Manage system services: Enable at boot and start the following processes in this order rpcbind, nfs-common, netfs (nfs-common won't start unless rpcbind is already started). Autofs will already be enabled at boot because of step 1 but you'll need to start it if you don't won't to reboot before testing.

4. Test that autofs is working by navigating to /net/hostname-of-nfs-server/. You should see the paths that are being exported by your NFS server. There is an entry in the auto.master file that automatically mounts all nfs servers in your hosts list to the /net directory

5. (Optional) Modify auto.master to mount any number of subdirectories from your nfs server according to this How To or
Code: [Select]
man auto.master
« Last Edit: August 28, 2012, 10:16:24 PM by tilaloz »

Offline Just17

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 11066
  • MLUs Forever!
Re: [SOLVED] Using autofs or amd to automount NFS shares
« Reply #9 on: August 29, 2012, 02:10:23 AM »
Quote
I've never written a tutorial before but ...

Thanks for the above post.

If I might make a suggestion .....  if you could add examples of the entries visible in the relevant files and a short explanation of what they mean, I believe that would be helpful to those who might wish to implement this.

regards.
MLUs rule the roost!

Linux XPS 3.4.48-pclos1.bfs  64 bit
Intel Core2 Quad CPU Q9450 @ 2.66GHz
4 GB RAM
MCP51 High Def Audio
GeForce GTX 550 Ti
PHILIPS  ‎DVD+-RW DVD8701
‎Logitech ‎BT Mini-Receiver
Afatech DTT