I have a somewhat old NAS hosting my music collection. It is not capable of running a DAAP media server so I have mounted the music folder on my Sheevaplug (a tiny headless server running Debian) which then runs the DAAP media server.

It works perfectly, but the problem is that the mounting of the samba share prevents the NAS from going into hibernation when there is no activity. If I unmount the share manually, the NAS will hibernate after some time.

Because of that I am looking after a way to automatically mount the network drive when needed (ie. accessed) and unmount it again after a period with inactivy.

I have tried inotifywait to monitor read access in the mount point, but unfortunately that does not catch reading from files not found which is what happens when the DAAP server tries to stream a music file in the empty folder.

Then I have googled more and have found autofs which seems to be able to do exactly what I need. But unfortunately, even after reading a guide like this, I still don't understand how to use it.


I was confused by the small differences between Debian and Gentoo. In Gentoo the config file is /etc/autofs/auto.misc whereas Debian uses /etc/auto.misc and so on.

Adjusting for those subtle differences, autofs works perfectly. It mounts the samba share when needed and unmouns it again after the timeout period given in auto.master

  • 2
    autofs seems to be what you're looking for, where did you stop in the guide? Jul 31, 2011 at 1:18
  • It was very late when I asked my questions and apparently I didn't think clearly enough. Because I just tried again and it works perfectly! I think I was confused by the small differences between Debian and Gentoo, for example in Debian the config file is /etc/auto.misc and not /etc/autofs/auto.misc as in the guide.
    – marlar
    Aug 1, 2011 at 12:28

1 Answer 1


Using autofs is quite simple.

In the file /etc/auto.master you specify parts of the configuration. Each part has a directory specified into which are the configured mounts mounted.

For example in my configuration, I have:

/nfs /etc/auto.nfs

This means, whatever is configured in /etc/auto.nfs will be mounted into the /nfs directory.

Now in the separate configuration files, you directly specify the mounts.

Again in my configuration, I have:

storage -rw,soft,intr,rsize=8192,noatime,async

Meaning: create a subdirectory storage in /nfs that will be a nfs mount The options are specified in the middle and they are the same, you would specify in /etc/fstab.

  • Don't you miss the -fstype parameter to specify that it is a nfs mount?
    – marlar
    Aug 4, 2011 at 9:26
  • @marlar Actually not. You don't need to specify filesystem type if it can be auto detected. Aug 4, 2011 at 10:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .