Re: /net

From: Boyd (tbmoore_at_bealenet.com)
Date: 10/20/03


Date: Sun, 19 Oct 2003 20:48:48 -0400

Arshad Sheik wrote:
> I get /net for autofs working for our environment, but the problem is
> that I can't traverse into sub dirs.
>
....
I have 2 hosts that are automounting back and forth. I am running
Debian stable on one (host: woody). And Debian unstable on the other
(host: sid).

On woody, I set the file /etc/exports to be:

# /etc/exports: the access control list for filesystems which may be
exported
# to NFS clients. See exports(5).
# / sid(rw)
/home sid(rw)
/var sid(ro)
/usr sid(ro)
/tmp sid(rw)
/overflow sid(ro)

On sid, I used the default autofs files:

/etc/auto.master contains:

# $Id: auto.master,v 1.2 1997/10/06 21:52:03 hpa Exp $
# Sample auto.master file
# Format of this file:
# mountpoint map options
# For details of the format look at autofs(5).
/var/autofs/misc /etc/auto.misc
/var/autofs/net /etc/auto.net

And /etc/auto.net contains:

#!/bin/sh

# $Id: //depot/autofs-4.0/samples/auto.net#6 $

# Look at what a host is exporting to determine what we can mount.
# This is very simple, but it appears to work surprisingly well

key="$1"

# add "nosymlink" here if you want to suppress symlinking local filesystems
# Note: "nonstrict" is now set by default, remove it if you don't want it.
opts="-fstype=nfs,hard,intr,nodev,nosuid,nonstrict"

# Showmount comes in a number of names and varieties. "showmount" is
# typically an older version which accepts the '--no-headers' flag
# but ignores it. "kshowmount" is the newer version installed with knfsd,
# which both accepts and acts on the '--no-headers' flag.
#SHOWMOUNT="kshowmount --no-headers -e $key"
#SHOWMOUNT="showmount -e $key | tail +2"

# Newer distributions get this right
SHOWMOUNT="/sbin/showmount --no-headers -e $key"

$SHOWMOUNT | LC_ALL=C sort +0 | \
         awk -v key="$key" -v opts="$opts" -- '
         BEGIN { ORS=""; first=1 }
                         { if (first) { print opts; first=0 }; print "
\\\n\t" $1, key ":" $1 }
         END { if (!first) print "\n"; else exit 1 }
         '

This latter is a shell script which returns the following when it is
executed by the autofs daemon:

(I get this when I run the script: /etc/auto.net woody):

  -fstype=nfs,hard,intr,nodev,nosuid,nonstrict \
         /home woody:/home \
         /overflow woody:/overflow \
         /tmp woody:/tmp \
         /usr woody:/usr \
         /var woody:/var

If I remember correctly, if the auto.xxx file is a script, it is
executed and it output takes the place of what would normally be read
from the file auto.xxx. In other words, I believe it would work if I
created auto.net to contain the lines above in the file.

I hope this helps. I have no trouble going down into the subdirectories.

One thing I would ask, in your case, is the subdirectory on the same
mount point as the parent? If not, you will have to mount it
separately, and also exportfs it.

Boyd



Relevant Pages

  • Re: [autofs] [RFC] Towards a Modern Autofs
    ... >entangling autofs with that work. ... >filesystem it's willing to export. ... >>map is mounted. ... The result is that some users will see mount points ...
    (Linux-Kernel)
  • Re: [autofs] [RFC] Towards a Modern Autofs
    ... entangling autofs with that work. ... > map is mounted. ... I don't quite see the need for the mapkey mount option. ... But in sec. 5.3.2 I see you making filesystem dirs in /tmp which seem to ...
    (Linux-Kernel)
  • Re: How to Mount devices
    ... > I am testing a couple of versions of Linux, Knoppix and Fedora. ... > I want to open a console session and mount the same devices in Fedora, ... specify the file system. ... For such cases we have the autofs application. ...
    (alt.linux)
  • Re: [VFS-RFC] autofs4 and bind, rbind and move mount requests
    ... The result is very similar to move mount. ... > I don't think it should because autofs needs be true to the mount maps ... do_add_mountcall (which places the vfsmount on the expiry list), ... If you just want to disable bind, ...
    (Linux-Kernel)
  • Re: Auto.net syntax.
    ... my version of of autofs is 3.1.7-41. ... # Look at what an host is exporting to determine what we can mount. ... # Showmount comes in a number of names and varieties. ... # which both accepts and acts on the '--no-headers' flag. ...
    (comp.os.linux.misc)