Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-13-2015, 09:27 PM   #1
Registered: Jul 2011
Location: Harrisburg, PA
Posts: 120

Rep: Reputation: Disabled
NFS won't mount on boot, but good manually (Debian using NFS4)

I've setup a NFS4 file share on an usb drive on a server at home for my personal use. Both client and server use Debian stable (3.2.0-4-amd64). I followed the tutorial here:

My setup seems to work fine if I mount it manually, just won't mount at bootup. Looking around online I see that this has been a common and long-standing problem- evidently the system tries to mount the NFS before the network is up.

I found a work-around- add this line to the /etc/rc.local file:

mount -a -t nfs4
Now it works, but of course I still have to wait for the initial timeout (60 seconds?) and a few more for this to work.

I find this really odd. Lots of online discussion about this for many years going. What is the real story on this? Is there some configuration setting that I (and many others) have simply missed?

BTW- many of the solutions I see online are old, won't work with NFS4, or are OS specific.

Keith Ostertag
Old 02-14-2015, 01:55 AM   #2
Registered: Jan 2015
Posts: 35

Rep: Reputation: 4
Did you try the auto boot solution provided in
Old 02-14-2015, 07:30 AM   #3
Registered: Jul 2011
Location: Harrisburg, PA
Posts: 120

Original Poster
Rep: Reputation: Disabled

Thanks for the link!

There are slight differences in the mount options between the two tutorials on both the server and client sides.... it will take me some time to go over them to understand what is going on. (lots of interactions).

Old 02-14-2015, 10:48 AM   #4
Registered: May 2006
Location: UK
Distribution: Debian
Posts: 448

Rep: Reputation: 37
fstab accepts a "_netdev" option that supposedly delays a mount attempt until after the network is up. I haven't tried it myself, but that might be what you want.

EDIT: to clarify it's an option for mount(8) that you can put in /etc/fstab. From the mount man page:

Some of these options are only useful when they appear in the /etc/fstab file.
_netdev   The filesystem resides on a device that requires network access
          (used to prevent the system from attempting to mount these filesystems
          until the network has been enabled on the system).

Last edited by Daws; 02-14-2015 at 11:04 AM. Reason: clarity
Old 02-14-2015, 11:46 AM   #5
Registered: Jul 2011
Location: Harrisburg, PA
Posts: 120

Original Poster
Rep: Reputation: Disabled
Thank you DAWS. I had read that before, but I had also read it doesn't work with NFS4.... (at least not with every OS)

see this for example:

where it says "Under NFSv3 (type nfs) the _netdev option will tell the system to wait to mount until the network is available. With a type of nfs4 this option is ignored, but can be used with mount -O _netdev in scripts later. Currently Ubuntu Server does not come with the scripts needed to auto-mount nfs4 entries in /etc/fstab after the network is up. "

I can't (today at least) test all this out. I did find this:

that says to make that work you _also_ need to enable

chkconfig netfs on
But again, I haven't yet had time to try it...

Old 02-14-2015, 03:06 PM   #6
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 823

Rep: Reputation: 237Reputation: 237Reputation: 237
Without having read the links this thread pointed to I'll just throw out the following idea: How about putting a small mount script into /etc/network/if-up.d/ ?
Old 02-15-2015, 03:45 AM   #7
LQ Newbie
Registered: Aug 2003
Location: Chicago, IL USA
Distribution: Debian 8 Jessie *gnome /kde. Ubuntu mate
Posts: 18

Rep: Reputation: 2
did you add it to the exports of the nfs server and you should be using /etc/fstab on the workstation to mount it on boot.

on the client sudo showmount -e "ip or hostname of server" without the quotes to make sure its exported if not you will need to export it.

workstation in /etc/fstab
server:/share /mountlocation/folder "on workstation" nfs rw,hard,nfsvers=3,nolock,intr 0 0

NFS4 is a different setup but similar. check the man pages for nfs3 or 4 for proper setup
Old 02-15-2015, 02:32 PM   #8
Registered: Jul 2011
Location: Harrisburg, PA
Posts: 120

Original Poster
Rep: Reputation: Disabled
I can mount manually fine- that means (AFAIK) that my server exports and my client /etc/fstab are working. I've tried various mount options (such as _netdev) with no apparent change.

The first tutorial I was following is a bit complex, and is intended for Jessie with systemd- since I am using Wheezy (without systemd) I purged all the relevant daemons and reloaded only what is called for in the link provided by linuxtech99 -

Still, no joy. I can manually mount the NFS directory and create files just fine, but it won't load on bootup.

On bootup I see this (as the system is loading):

Configuring network interfaces... Starting rpcbind daemon....
Starting NFS common utilities: statd idmapd.
After about 60 seconds the display continues with this:
mount.fs: Connection timed out.
Here's the relevant lines from the output from manually entering (which works):
mount -t nfs -a
Code: on /nfs_usb type nfs4 (rw,relatime,vers=4,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=,minorversion=0,local_lock=none,addr=
Is there a way to see what is going on in the background as it is attempting to connect with the server? I tried loading idmapd manually on the server with
rpc.idmapd -vvv -f
and watched it while I booted the client... nothing. If I then mount the share manually from the client I can see the server idmapd display the connection (with no errors).

Do you know of another way to debug this? Yes I can simply write some kind of script to take care of mounting at boot, but I'd like to know why it is not working automatically as in the tutorial.

Keith Ostertag
Old 04-28-2016, 04:27 PM   #9
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,833
Blog Entries: 14

Rep: Reputation: 1081Reputation: 1081Reputation: 1081Reputation: 1081Reputation: 1081Reputation: 1081Reputation: 1081Reputation: 1081
NFSv4 Mounts on RHEL5 - SOLVED

Old thread I know but I just ran into this issue on RHEL5 trying to mount NFSv4 shares from ExaGrid deduplication appliances.

Many of the hits online are red herrings talking about iptables but that is only an issue if you are sharing from the RHEL server (i.e. NFS server) not if you are mounting on the RHEL server (i.e. NFS client).

Originally RHEL5 didn't support NFSv4 (in fact some of their documentation still says not to use it). But as the OP notes it mounts correctly after boot - just doesn't mount automatically during boot.

I was seeing error during boot on mine when it got to the NFS mounts even though above it it indicated the network interfaces had started:
Mounting NFS filesystems: mount: mount to NFS server 'atlexag1' failed: System Error: No route to host. [FAILED]
On running "chkconfig --list netfs" I saw it was in fact set to start automatically. On review I noticed this script does in fact include mount for both nfs and nfs4.

My mount options were:
myhost:myshare     /mymountdir     nfs4     hard,intr,retrans=15    1 4
Adding "_netdev" did NOT help:
myhost:myshare     /mymountdir     nfs4     hard,intr,retrans=15,_netdev    1 4
Reading indicated _netdev is supported by nfs but not nfs4 on some distros including apparently RHEL5.

One post suggested adding the "hard" option but as seen that was already there. However, I noticed they also had the "bg" option for backgrounding the mount. This makes it request the mount but not wait for it to complete during boot. Instead it retries in the background until it succeeds. The error about "no route to host" made me think it was trying to do the mount too quickly after the interface (which is a 10 GigE in our case and not the primary) has been started so it isn't fully functional.

Accordingly I changed my mount options to include "bg":
mysharehost:myshare     /mymountdir     nfs4     bg,hard,intr,retrans=15    1 4
After doing that and rebooting (which I tested a few times)it no longer output the "no route to host" error and instead of showing as "[FAILED]" it displayed as "[OK}" during boot. After boot completed it had successfully automatically mounted the nfs4 filesystem.

P.S. On RHEL6 these same NFSv4 shares mount automatically without the "bg" option as we originally had it. This appears to only be an issue on RHEL5 (and presumably distros based on it such as CentOS5).

Last edited by MensaWater; 04-28-2016 at 04:30 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
nfs4 - mount.nfs4: access denied by server while mounting edwin11 Linux - Networking 1 12-07-2010 10:06 AM
How to mount older NFS clients to newer NFS4 servers Larry James Fedora 1 11-23-2009 09:31 AM
why do I have to mount NFS shares manually in ubuntu 9.04? lxuser Linux - Networking 3 07-12-2009 11:55 PM
Can't mount nfs share from fstab but can mount it manually - help Mountain Linux - Networking 1 03-30-2008 08:34 PM
NFS server won't mount during boot up - OpenSuSE 10.3 Micro420 SUSE / openSUSE 5 10-20-2007 03:03 AM

All times are GMT -5. The time now is 06:11 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration