Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an entry in my local machine's /etc/fstab to mount an NFS partition on a remote host:

remotehost:/ /media/blabla nfs4 defaults,nobootwait 0 0

When I try to boot the machine while the remote host is down, the boot process halts with an error.

mount.nfs4: Connection timed out
mountall: mount /media/blabla [915] terminated with status 32

I have to bring the remote host back up before I can get my machine to boot. Now, if the partition is local I would be able to solve this using the nobootwait option, but it doesn't help here.

How can I set this up to ignore mount errors and boot normally even for remote partitions?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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 &
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.