Operating System - HP-UX
1821246 Members
2815 Online
109632 Solutions
New Discussion юеВ

how does NFS entry work in /etc/fstab?

 
zhaogui
Super Advisor

how does NFS entry work in /etc/fstab?

Can anybody tell me how does NFS entry in /etc/fstab work? Is it similar to normal file systems such as /var, /opt, which are controlled by automountd? If yes, then is /etc/rc.config.d/nfsconf and /sbin/init.d/nfs_client redundant? This is for NFS client. On NFS server side, I believe I can just create /etc/exports and " exportfs -a" will be done automatically by /etc/rc.config.d/nfsconf and /sbin/init.d/nfs_server start, it that correct?

One more question, compared normal NFS mount with NFS automount(defined by /etc/auto_master,auto_direct), which one is better? Does NFS automount eliminate the "Stale NFS handle" problem?

6 REPLIES 6
T G Manikandan
Honored Contributor

Re: how does NFS entry work in /etc/fstab?

Just give and entry like this

:/home /UCM nfs rw,suid 0 2

Here /home is the remote file system
/UCM is the local mount point for the remote file system.The type of file system is nfs.It is read-write.2 is the pass number used for fsck(file system check).


Thanks
G Manikandan
S.K. Chan
Honored Contributor

Re: how does NFS entry work in /etc/fstab?

The NFS entry in /etc/fstab is not similar to the local FS (/var,/opt) in the sense that the validity of the entry depends on whether the remote FS is exported or not. If it is not exported, upon bootup the remote NFS mount will failed. It also means the NFS mount point is permanent until you unmount it manually or until the systm reboots. The "automountd" daemon that you mentioned has nothing to do with local FS like /var, /opt. This is a automount daemon for AutoFS which is started depending on the control file /etc/rc.config.d/nfsconf.
Well you're not correct, on the NFS server side, "export -a" is done by /sbin/init.d/nfs.server upon boot-up (or if manually re-run the script), NOT automatically. For example if you edit /etc/exports you must still execute..
# exportfs -a
afterwards, otherwise the FS will not be exported. Or you can run ..
# /sbin/init.d/nfs.server stop
# /sbin/init.d/nfs.server start
but you would NOT want to do that because the server might have an active NFS connection.
Definately NFS automount is much better than the usual hard mount points. This is because automount or autofs is based on "as-needed" basis. Meaning the remote FS will only be mounted when you access to the directory (example: you cd to it) and once you're out from that directory, the FS will be automatically umounted after a short time (matter of few minutes). Finally automount minimizes "stale NFS mount" problem, it does not totally eliminate it. For example consider you're accessing an automounted directory and suddenly the server crashed, so the automatic umount does not happen on time, thus you'll still see the "stale NFS" problem.
T G Manikandan
Honored Contributor

Re: how does NFS entry work in /etc/fstab?

chan is right.
The problem is by default the NFS mount are hard mountsi.e if the remote file system is unavailable the local machine retries that file system using nfs again and again.
It is good to go for soft mounts where retries are 2 or 3 times for mounting the remote file system.

If it is a hard mount and the remote file system is unavailable,you reboot your machine then it gets struck during boot up keeps on retrying the remote file system.

Soft mount is a good option.

THanks
Michael Tully
Honored Contributor

Re: how does NFS entry work in /etc/fstab?

Hi,

The example given by TG is for importing a filesystem NFS mount point from another server. Using the /etc/exports file is for exporting a filesystem to a client, the client being the one that has the entry in /etc/fstab on the remote system.

Suggest you have a look at the online manual at the following link. Use the search facility from within the page. It is very helpful and points out common problems with Stale NFS handles and the information your after with automount usage.

http://www.docs.hp.com/hpux/onlinedocs/B1031-90048/B1031-90048.html
Anyone for a Mutiny ?
zhaogui
Super Advisor

Re: how does NFS entry work in /etc/fstab?

What I thought is I only need to create /etc/exports and configure nfsconf and nfs.server or nfs.client,nfs.core, so that next time if you happen to reboot the system, you don't need to manually run exportfs, the startup script will do that for me. But on client side, how do I create an entry in /etc/fstab?

Again, I noticed that normal NFS mount is using rpc.mountd. Is it using portmap with port 111, how about automount? How come I couldn't find out any entry for rpc.mountd in both /etc/services and /etc/inetd.conf?

I have ever created an NFS package in MCSG environment but it could not survive a failover and I got "Stale NFS mount" after I run cmhaltnode.
Has anybody get solution to deal with this problem or should I switch to automount?
How can I switch normal NFS to automount?
Gnananandhan
Frequent Advisor

Re: how does NFS entry work in /etc/fstab?

:/tmp /local/tmp nfs rw 0 2
The above entry in /etc/fstab will do well to mount a /tmp file-system from the remote system.
And in the server side exportfs is executed for every reboot and will export all file-system in /etc/exports.

Regards,
Gnana A.
If there is a better way to do it, find it !