I'm using Ubuntu 12.04 with XBMC and am streaming media files from my fileserver (mounted using NFS).

Right now I have fstab configured to mount my NFS share like this:   /mnt/media   nfs4 _netdev,auto     0 0

However, sometimes the mount is not yet available (?) when XBMC starts, so when I try to play a file from that mount it freezes (i.e. just waits, and waits...). To fix the problem I need to SSH into the server and mount -a. (or it sometimes I can wait a few minutes and it might fix itself and/or finish mounting.

Is it better to use AutoFS for this situation? If not, what other options are available?

EDIT: I also want the mount to be resilient against file server downtime or weird network issues, etc.


I have used static mounts for years for media files with good results since we want them highly available. However we have a dedicated HTPC/MediaServer runinning 24/7 (it takes backups at night from the destops too). I've thought AutoFS seemed complicated vs just mounting the server partitons in fstab and letting them run. I don't like switching harddisks off and on.

I wonder why your mounts are behaving like this? is something odd about how you've setup your nfs4 mounts? I think I fixed a similar problem with the 'crossmnt' option on the parent directory in the /etc/exports entry. The child mounts would be delayed for a while after I opened the parent export folder. I think with the crossmnt option on the top level /etc/export entry; the child mounts popped up quickly but it has been a while since I solved that issue.

Listing your /etc/exports would help.

On the client side:

$cat /proc/mounts | grep nfs4

will show all the client nfs4 mount options you are ending up with.

This from might help you from nfs - fstab format and options for the nfs file systems

   bg / fg        Determines  how  the  mount(8)  command  behaves  if  an
                  attempt  to mount an export fails.  The fg option causes
                  mount(8) to exit with an error status if any part of the
                  mount  request  times  out  or  fails outright.  This is
                  called a "foreground" mount, and is the default behavior
                  if neither the fg nor bg mount option is specified.

                  If  the  bg  option  is  specified, a timeout or failure
                  causes the  mount(8)  command  to  fork  a  child  which
                  continues  to  attempt  to mount the export.  The parent
                  immediately returns with a  zero  exit  code.   This  is
                  known as a "background" mount.

                  If  the  local  mount  point  directory  is missing, the
                  mount(8) command acts as if the mount request timed out.
                  This  permits  nested NFS mounts specified in /etc/fstab
                  to proceed in any order  during  system  initialization,
                  even   if  some  NFS  servers  are  not  yet  available.
                  Alternatively these issues can  be  addressed  using  an
                  automounter (refer to automount(8) for details).

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.