Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a few servers running CentOS 5.3, and am trying to get 2 NFS mount-points to mount automatically on boot. I added 2 lines similar to the following to fstab:

server1:/path1                /path1           nfs     soft            0 0
server2:/path2                /path2           nfs     soft            0 0

When I run 'mount -a' manually, the mount points are properly mounted as expected. However, when I reboot the machine, only /path2 is mounted. For /path1 I get the following error:

mount: can't get address for server1

It obviously looks like a DNS issue, but the record is properly configured in all the DNS servers and is mounted properly if I re-try the mount after the reboot is completed. I could properly fix this by using IP address instead of hostnames in /etc/fstab or adding server1 to /etc/hosts but I would rather not do that.

What might be the reason for failing to resolve this specific address during boot time? Why the problem is only with the 1st mount point and the 2nd is properly mounted despite having identical configuration?

share|improve this question

3 Answers 3

How does your machine get its DNS configuration?

  • are you using DHCP ?
  • are you allowing enough time for the LAN interface to come up before starting the NFS mounts?

The latter problem can be caused, for exmaple, by ethernet switch ports that don't come live instantly when they detect a client coming online.

share|improve this answer
    
Static IP configuration, no DHCP. The DNS servers are set statically in /etc/resolv.conf. When booting, it says: Bringing up interface eth0 [OK] Much before the mount error, so I assume the network is functional at that time. –  sagi Sep 21 '09 at 11:07
    
how much before? I've seen switch ports that take 30s to start forwarding traffic. –  Alnitak Sep 21 '09 at 11:19
2  
The 30 second delay is Spanning Tree doing loop detection. STP on most of the switches I've used will time out after 30 seconds if no STP speaker is detected by the switch. You can disable STP on a per-port basis on most managed switches. On Cisco IOS, you would do "spanning-tree portfast", which will cause the port to become immediately available. –  James Sneeringer Sep 21 '09 at 13:43
    
@James - yes, that's the one. I couldn't remember what the setting was called. –  Alnitak Sep 22 '09 at 8:55

had the same issue, on CentOS 5.3, i did

1) enable STP portfast on the switch (cisco)

spanning-tree portfast default 

2) changed the nfs mount in fstab to

server:/dir   /dir   nfs   _netdev,rw,bg,hard,intr   0  0

and now it works just fine.

share|improve this answer

Add the bg in the option part.

server1:/path1 /path1 nfs bg,soft 0 0

This puts the mounting in background modus. Once the server is available the mount will be available.

Good luck.

This does not solve the DNS problem, but it solves the mounting problem :-)

share|improve this answer
    
Tried, it made no difference.. I am not sure that it works with the soft mode. –  sagi Sep 21 '09 at 9:35

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.