I'm automatically mounting a NFS with fstab. Sometimes the mount fails because the hostname of the NFS mount cannot be resolved (getaddrinfo failed). I'm assuming that this happens because the network initialization is slower than the mounts.

Is there any way to initialize the network before mounting any devices? I'm already using _netdev as a mount option but this does not help.

This is my current fstab file:

# <file system> <mount point>   <type>  <options>   <dump>  <pass>
/dev/md2    /   ext3    errors=remount-ro   0   1
/dev/md1    /boot   ext3    errors=remount-ro   0   1
/dev/sda3   swap    swap    defaults    0   0
/dev/sdb3   swap    swap    defaults    0   0
connect.mygluster.net:/data /var/gluster/data glusterfs ro,_netdev 0
  • What platform/flavor you working with? – Jason Huntley Mar 27 '12 at 16:06
  • Debian 6/GlusterFS – Philip Mar 27 '12 at 16:11
  • Would it be possible to share your /etc/fstab config? – Jason Huntley Mar 27 '12 at 16:27
  • @jason I've updated my original question. – Philip Mar 27 '12 at 16:33

IMO, I don't recommend modifying fstab to mount NFS folders. Instead, you can customize the startup script of the dependent service to mount the NFS folder before starting the service.

Another option is to create a new startup script under /etc/init.d to mount NFS folder. You can copy some of the already available services file and use it. You need to make sure it contains a line like:

# Required-Start:    $network other-stuff...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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