The mount command in linux requires -t nfs4 in order to mount version 4 NFS shares, so I need to know beforehand which version it is.
Per: NFS version 3 and 4 with TCP/IP protocols, you could enter either of these commands:
rpcinfo -p <hostname> |grep nfs rpcinfo -s <hostname> |grep nfs
Note: All flavours of the command appear to support the -p argument, while the Solaris and GNU linux variants also support the -s variant.
You could include some logic, based around the enquiry, into a shell script that instantiates a variable that could be pluged into a mount command e.g.
nfsHost="184.108.40.206" ARRAY=`rpcinfo -p $nfsHost |grep nfs |sed -e "s/ [\s ]*/ /g" -e "s/^ //" |cut -f2 -d" "` Ver=0 for i in $ARRAY ; do if [ "$i" -gt $Ver ] ; then Ver=$i;fi;done if [ $Ver -gt 0 ] then echo "Host: $nfsHost supports NFS version $Ver"; mount -o vers=$Ver........... fi