Friday, June 05, 2009

Ubuntu 9.04 NFS Server with Solaris 10 automounter nfs client

1. Download the ubuntu nfs packages and install:

# sudo apt-get install nfs-kernel-server nfs-common portmap

2. Setup the /etc/exports file:

# sudo vi /etc/exports

add the nfs export line, for example:

/software 192.168.0.0/24(rw,fsid=0,no_root_squash,async,no_subtree_check)

and export the share and check the nfs server list:

# sudo exportfs -a
# sudo exportfs
/software 192.168.0.0/24

3. Next, setup the Solaris client. It is useful to first manually mount the share. Update the /etc/default/nfs client so that the maximum revision is 3, so that the client and server can talk to each other:

# vi /etc/default/nfs

and change:

# Sets the maximum version of the NFS protocol that will be used by
# the NFS client. Can be overridden by the "vers=" NFS mount option.
# If "vers=" is not specified for an NFS mount, this is the version
NFS_CLIENT_VERSMAX=3

4. Test that the client can mount the share:

# showmount -e ubuntu
export list for ubuntu:
/software 192.168.0.0/24
# mount ubuntu:/software /mnt
# ls /mnt
oracle
# cd /
# umount -f /mnt

5. Now setup the automounter as we don't want /mnt mounted all the time. Edit the /etc/auto_master file and add in an entry for a auto_direct map:

# cat /etc/auto_master
#
# Copyright 2003 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "@(#)auto_master 1.8 03/04/28 SMI"
#
# Master map for automounter
#
+auto_master
/net -hosts -nosuid,nobrowse
/home auto_home -nobrowse
/- auto_direct

and create the /etc/auto_direct file:

# cat /etc/auto_direct
/mnt -rw ubuntu:/software

next, restart the autofs service and test:

# svcadm disable autofs
# svcadm enable autofs
# df -h /mnt
Filesystem size used avail capacity Mounted on
auto_direct 0K 0K 0K 0% /mnt
# cd /mnt
# ls
oracle
# df -h /mnt
Filesystem size used avail capacity Mounted on
ubuntu:/software 7.5G 2.9G 4.2G 42% /mnt

No comments: