How can I determine if an NFS remote is exporting a directory?

For 3) you probably want to use showmount -e remote_nfs_server which shows if remote_nfs_server has exported anything.

And for 2) if you don't want to use a shubshell and know if the remote server runs NFSv3 or NFSv4 and if TCP or UDP, you could query for that specifically with rpcinfo:
rpcinfo -u remote_nfs_server nfs 3 for NFSv3 via UDP and
rpcinfo -t remote_nfs_server nfs 4 for NFSv4 via TCP

For 4) you may want to look at Check if folder is a mounted remote filesystem


Further information:

  • Remote procedure call tools | Managing NFS and NIS
  • NFS Diagnostic Tools | Managing NFS and NIS

You can use showmount -e <server> for some aspects of #3. When the exports are simple, it would at least suggest that a directory (or perhaps a parent of such a directory) is exported.

# showmount -e server
/export                               (everyone)

For #2, I'm not sure what you're looking for. If you're using NFSv3, you'll be looking for at least mountd and nfs (and in some cases may want to confirm lock managers). You could check for any explicitly with rpcinfo as you say.

# rpcinfo -t server mountd 3
program 100005 version 3 ready and waiting