ZFS and the automounter

So, you have ZFS, and you create lots and lots of filesystems, all the
time, any time you like.

Problem: new filesystems don’t show up in /net (-hosts special automount
map) once a host’s /net entry has been automounted.

Solution #1: wait for OpenSolaris to gain support for client-side
crossing of NFSv4 server-side mount-points.

Solution #2: replace the -hosts map with an executable automount map that
generates hierarchical automount map entries based on showmount -e output.

The script is pretty simple, but there is one problem: the automounter
barfs at entries longer than 4095 characters (sigh).

#!/bin/ksh
exec 2>/dev/null
if [[ $# -eq 0 ]]
then
logger -p daemon.error -t ${0##*/} "Incorrect usage by automountd!"
exit 1
fi
entry="/ $1:/"
showmount -e $1|sort|grep '^/'|while read p junk
do
entry="$entry $p $1:$p"
done
print "$entry"
logger -p daemon.debug -t ${0##*/} "$entry"

~ by nico on April 25, 2006.

Leave a Reply

Your email address will not be published. Required fields are marked *