[CentOS] NFSv4 on CentOS 5.5

Sat Dec 22 19:41:28 UTC 2012
Ljubomir Ljubojevic <office at plnet.rs>

On 12/22/2012 12:33 AM, Tim Gustafson wrote:
> Hi,
>
> What is the magic juju that I have to put in /etc/sysconfig/autofs to
> get autofs to default to using NFSv4, rather than NFSv3, for mounting
> file systems?
>
> I don't want to place these flags into the automount maps themselves
> because we have a varied network with Sun, CentOS, RedHat and
> Macintosh systems, and the flags that have to get added to automount
> maps (which we distribute centrally through LDAP) are different for
> each OS.  So, I'd prefer to specify the local machine options in
> /etc/sysconfig/autofs rather than in the global automount map.
>
> Thanks!
>

These are my unrefined notes on the topic:

NFS4 on CentOS 5.x Server

• create /nfs4exports with subfolder: extra.
•  in /etc/fstab put:
/extra                  /nfs4exports/extra      bind    bind            0 0

• In /etc/exports put:
/nfs4exports 
xxx.yyy.zzz.qqq/255.255.255.248(rw,fsid=0,sync,no_root_squash,no_subtree_check)
/nfs4exports/extra 
xxx.yyy.zzz.qqq/255.255.255.248(rw,no_subtree_check,nohide,sync,no_root_squash)


• In /etc/sysconfig/nfs put:
LOCKD_TCPPORT=32803
# UDP port rpc.lockd should listen on.
LOCKD_UDPPORT=32769
RPCNFSDARGS="-N 2 -N 3"
MOUNTD_PORT=892
STATD_PORT=662
# Outgoing port statd should used. The default is port
# is random
STATD_OUTGOING_PORT=2020
# Specify callout program

Nikada ne skidati root squashing, spusta roota na nfsnobody nivo. Ima i 
all_squash opcija.

/etc/idmapd.conf:
[General]

Verbosity = 0
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = yourdomain.com

[Mapping]

Nobody-User = usernameiwant
Nobody-Group = usernameiwant

[Translation]
Method = nsswitch

Restart daemons and check with showmount -e server IP

Client:


/etc/auto.master:
/autofsmounts/servername  /etc/auto.servername --timeout=10


/etc/auto.servername:
extra	-fstype=nfs4,rw,proto=tcp	server.domain.com:/extra


/etc/idmapd.conf:
[General]

Verbosity = 0
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = yourdomain.com

[Mapping]

Nobody-User = usernameiwant
Nobody-Group = usernameiwant

[Translation]
Method = nsswitch


Create /autofsmounts/servername

Restart autofs daemon

In one terminal do "cd /autofsmounts/servername/extra" so that folder is 
create/mounted by autofs

Create /servername and in it create softlinks for:
  /autofsmounts/servername/extra

And that is it.

Some commands:

test : showmount -e <ipaddress>

mkdir /autofsmounts
mkdir /autofsmounts/servername

echo 'extra	-fstype=nfs4,rw,proto=tcp	server.domain.com:/extra' > 
/etc/auto.servername

-- 

Ljubomir Ljubojevic
(Love is in the Air)
PL Computers
Serbia, Europe

Google is the Mother, Google is the Father, and traceroute is your
trusty Spiderman...
StarOS, Mikrotik and CentOS/RHEL/Linux consultant