On 02-Aug-99 Simon Burley wrote:
> 
> I'm trying to set up autofs' capability to do submounts. Is there any
> way to mount hosts under /hosts, and under the hostname, the exported
> filesystems, eg
> 
> /hosts/host1/shared_data1/
> /hosts/host1/shared_data2/
> /hosts/host45/shared_data/
> 
> I already have ~40 Silicon Graphics machines that automount under
> /hosts, and I'd like to have the capability to seamlessly integrate my
> linux boxes the same way, preferably without changing the setup of the
> SGI machines in any way, and without maintaining a database of exports.
> Is this do-able?

Have a look at http://www.goop.org/~jeremy/autofs.  I've done some patches
which allows a /net-style directory to mount all filesystems being exported
from a machine.  Well, that's the simple case - all the decision-making is done
in a shell-script, so you can easily tailor it to your needs.

For example, I have /etc/auto.net as a shell script:

---
#!/bin/sh

# Look at what a host is exporting to determine what we can mount.
# This is wildly simplistic - no attempt is made to see whether we can mount
# each filesystem, or whether its RO or RW.  For the future...

key="$1"
opts="-fstype=nfs,hard,intr,nodev,nosuid"

showmount --no-headers -e "$key" | sort | \
        sed -e "s|^\([^      ]*\).*|$key\1 $opts $key:\1|"
---

If you want, you can filter the output of showmount, put in a table-lookup,
or anything else.  The script just needs to output one or more lines of the
form:

local-dir  -fstype=type,options remote:/filesystem
ixodes/ -fstype=nfs,hard,intr,nodev,nosuid ixodes:/

        J

Reply via email to