HOWTO: NFSv4 primer PDF Print E-mail
User Rating: / 5
Written by Michael Felt   

What do I cover? A simple HowTo setup NFSv4 on AIX!.

I have been using NFSv4 for about two years accessing features not available in previous versions of NFS. The two main features I am interested in are: username recognition and a single mount point.

The basic steps are to choose and set a "domain" name" on the server, create exports including nfsroot, set the domain on a client, and mount the nfsroot.

A domain name can be any string but often it is a DNS like name. I chose a single word - rootvg. From memory, this is the key component for username recognition within a domain. While it might be technically interesting to understand exactly how it works - Let's not get bogged down in detail - read more for the primer!

Simple NFSv4 Server/Client setup

Step 1: Set the domain

# chnfsdom <domain-string> # e.g. chnfsdom rootvg

Step 2: Activate a new NFS daemon

# startsrc -s nfsrgyd

I can never remember the subsystem name - nfsrgyd - Instead I run the following two commands:

# nfs.clean
# rc.nfs

The rest of using NFSv4 is very similiar to using NFSv3 and/or NFSv2. For the server you should continue to use smitty mknfsexp, or just use mknfsexp from the command line. However, before you do - consider setting up all the areas you want to export under a common path, e.g. /nfs/*, or /export/*. I use /data/*. This will enable you to easily use a single mount command at the client to mount all the exported directories including automatic mounts and unmounts as directories as added or removed from the common mount point. The phrase to be watching for is variations of "mounting the NFSv4 server root directory".

Note that AIX has some added features so that directories that are not under the common name can be exported as if they are; however, I am not covering that in this initial note (i.e. my extended memory).

Step 3: setup NFS server exports

You can use smitty mknfsexp and/or command-line (I will use command line here).

# chnfs -r /data # set nfsroot, this is what clients mount as :/
# mknfsexp -d /data/test50 -v 3,4 -a 0 -B
# mknfsexp -d /data/mysql -a 0 -t ro -B
# mknfsexp -d /data/mysql -a 0 -v 4 -S sys -B
# mknfsexp -d /data/suma -v 3,4 -S sys,krb5 -t rm  -h x101,x106,x107 -B

And you will get an /etc/exports looking something like:

/data/suma -vers=3:4,sec=sys:krb5,rw=x101:x106:x107
/data/mysql -anon=0,ro
/data/mysql -anon=0,vers=4,sec=sys
/data/test50 -anon=0,vers=3:4

Setup Client

Step 1: Set the domain

# chnfsdom <domain-string> # e.g. chnfsdom rootvg

Step 2: Activate a new NFS daemon

# startsrc -s nfsrgyd

Step 3: mount the client

# mkdir -p /nfs # or anywhere else you want - this is just an example
#  mknfsmnt -f /nfs -d / -h <NFS_SERVER> -K 4 -B

Step 4: list nfsroot contents
# ls /nfs shows
suma mysql test50

That's it for now!

< Prev   Next >