2

I have setup 5 NFS mounts in /etc/fstab.

The first one "parent" mounts on local mount point /foo and the other 4 "child" in mounts points on the first one:

So let's say the second is /foo/test1. The third is in /foo/media etc...

Example:

192.168.0.101:/adventure-time    /foo           some-nfs-options
192.168.0.101:/south-park        /foo/test1     some-nfs-options
192.168.0.101:/futurama          /foo/media     some-nfs-options
/etc./

But when i do df -h after logging in (after reboot) it shows only the share on /foo... the others (in the sub-directories) are not mounted... So i type mount -a and everything is fine...

I check /var/log/messages and i saw that during boot when it tries to mount the "child" nfs exports which depend on folders in the "parent" one it whines about "no local mounts points found". So i assume it takes some time (we are talking 1-2 seconds more) to mount /adventure-time in /foo so during that time the folders test1 and media are not available... and therefore it fails to mount the other shares.Like it tries to mount everything at once...

Then after login when already these folders are present (because /adventure-time is already mounted in /foo) it mounts the other shares without problem (local mount points already exist)...

The question is how to make the "child" shares to be depending on the "parent" and wait for him to mount before they try?

Typing mount -a in /etc/rc.d/rc.local is only a workaround...

Is there some nfs option that i should put in fstab?

There has to be a solution for this? nfs (or the boot process) should not be that dumb... :/

3 Answers3

2

You want the bg mount option in /etc/fstab: this will cause the mounts which initially fail to background themselves and retry, when they will succeed.

1

There has to be a solution for this? nfs (or the boot process) should not be that dumb

The boot process isn't dumb. I haven't read the man pages for mount/nfs in a while but I don't recall there being any way to make one mount dependent on another.

It seems that you already have one solution - using a script. You may want to look at the mountpoint command which can help in this type of script.

Another solution might be autofs. You would mount your main NFS filesystem using fstab as normal and then use autofs to mount the sub filesytems on demand.

user9517
  • 117,122
0

If you're using a redhat-like distribution, be sure to enable the netfs service.

This should take care of your nested mounts. Test and see.

ewwhite
  • 201,205