You can add the noauto
flag in /etc/fstab to make the system not try to mount a particular file system automatically during the boot process. It's the opposite of the default auto
, and noauto
is commonly seen on file systems hosted on removable media such as CDs, floppies, removable hard disks, etc. It also works well for network file systems or if you simply for any reason need to control the mounting in more detail than the settings in fstab allows. This works for any file system type, not just NFS file systems.
Once the file system(s) in question have been set noauto
, you can add or edit a late init script to background a mount on the file systems in question. If the host is reachable it will finish quickly, and if the host is not reachable (network is down, host is down, whatever), it will (should; you never quite know with NFS) sit there in the background and wait for the timeout.
This approach does depend on nothing during or shortly after the boot process needing access to anything on that file system, but since that's the case in your situation, it should work.
To recap, in /etc/fstab set the relevant file system(s) to noauto:
remotehost:/ /media/blabla nfs4 defaults,nobootwait,noauto 0 0
and in for example /etc/rc.local (the specifics will depend on your distribution, but /etc/rc.local or /etc/rc.d/local might be good places to start):
mount /media/blabla &
The ampersand causes the mount process to be spawned in the background, where it will sit and wait until the mount either succeeds or times out. If you don't want any potential error output cluttering up the console, you can go fancy by redirecting its output to /dev/null:
mount /media/blabla 2>&1 >/dev/null &