How not to mount a particular server with autofs

There are a couple servers that I use the fancy new (to me at least) autofs scripts to mount on my Ubuntu 9.10 client machine. You know, the ones that let you just cd /net/servername/exportname and it automagically turns that into the command to mount that export from that server at that mountpoint (so cool). To test something out though, I wanted to make sure one of the servers was not auto-mounted by autofs. The simple way to tell autofs to ignore that server (let's call it, foobarbaz) is to edit /etc/auto.net and put this snippet right after the key="$1" line:

# don't mount foobarbaz, for now:
           
if [ $key = "foobarbaz" ]; then
    exit
fi

Then restart autofs:

sudo /etc/init.d/autofs restart

And autofs automagically mounts any nfs server except foobarbaz.

Comments

Mark T. Kennedy said…
except i think the recent releases of autofs have migrated the '/net' map from /etc/auto.net into something that runs directly in the automount process (the "-hosts" map).
Bryan said…
Hmm, good point, mtk. I should point out that this was on my Ubuntu 9.10 system. I suppose I should upgrade to 10.04 before 10.10 comes out :-)

Popular posts from this blog

SystemVerilog Fork Disable "Gotchas"

'git revert' Is Not Equivalent To 'svn revert'

SystemVerilog Streaming Operator: Knowing Right from Left