CIFS mounts hang on read

I would highly suggest AutoFS.

This will dynamically mount and unmount your network shares in the background, all transparent to the user. I used to have problems with unmounting and remounting mobile devices until I made the switch.

Unfortunately, there are far too many guides which overly complicate autofs setup. Assuming you’re on an Ubuntu box, here are the easy instructions on setting it up.

Here’s some very simple instructions:

  • Install from apt-get: sudo apt-get install autofs -y
  • Remove everything in /etc/auto.master and replace with: /- /etc/auto.cifs --timeout=20 --ghost
  • Add one line like this to auto.cifs for each mount:/mnt/LOCAL/MOUNT/PATH -fstype=cifs,rw,noperm,credentials=/etc/auto.credentials ://SERVER/MOUNT
  • In /etc/auto.credentials, add the following content:

    username=USERNAME
    password=PASSWORD
  • Finally, sudo service autofs restart.

That’s it.

Leave a Comment