Mount network drives dynamically

Discussion in 'OS X Mountain Lion (10.8)' started by SnifferUK, Aug 17, 2012.

  1. SnifferUK macrumors newbie

    Sep 11, 2010
    I am a relative newbie on OSX (only been using is since Lion - now upgraded to ML) and have been struggling with a problem for a little while.

    I have a number of network devices (some Windows machines and some NAS boxes) which my Mac connects to on a regular basis. I have OSX configured to mount network drives when it logs in, which is fine.

    However, if a network drive location disappears (or is not available on login) is there a way for OSX to dynamically (automatically?) re-mount the drive when it reappears similar to how Windows appears to do it ?

    My main role for one of my Mac Minis is as a Plex Server and as some of my network devices are not always powered on I want to be able to power them on and off (whilst my Mac Mini is always on) and have my Mac look for the location and mount it if it is available.

    I hope I've made my problem clear - any help greatly appreciated.
  2. meduk1 macrumors newbie

    May 30, 2008
    Any luck with this? Would like to do the same thing.
  3. Weaselboy Moderator


    Staff Member

    Jan 23, 2005
  4. marc.garcia macrumors regular

    Jul 26, 2010
    I would love to hear how to do this in case anybody had managed to pull this off.
  5. switon macrumors 6502a

    Sep 10, 2012
    RE: automount, automountd, autofs, autofsd, ...


    This is just an alternative suggestion, but you might also look into "automount" and its daemon, "automountd", and the "autofsd" daemon which are standard unix tools for automatically mounting and unmounting network drives. In fact, I believe Mac OS X uses these tools itself for the mounting of the various drives it uses. Whenever the network configuration changes, the autofsd daemon runs "automount" to update any mounts/unmounts required. So, if a device goes offline, then autofsd forces it to be unmounted while if a new device comes online that autofsd forces it to be mounted --- I think this is basically what you wish to happen, and since autofsd is already running anyway, all you have to do is setup the configuration files appropriately. In addition, these tools can be setup to unmount a drive that hasn't been accessed in a specified time interval and then to remount it when a request for access is made.

    There are various autofs.conf and "auto_master" configuration files and an Apple plist file to specify variables to control the automountd daemon.

    Good luck.

  6. marc.garcia macrumors regular

    Jul 26, 2010
    Hi Switon,

    is it possible to bind a network share mount to a specific application being accessed? I would like be able to configure my Plex app so that it can mount network shares when a files is requested from my thin client.

    I would appreciate your help with this.
  7. switon macrumors 6502a

    Sep 10, 2012
    RE: automount and autofsd....

    Hi marc.garcia,

    I'm not sure that you can make this app specific, say only when the Plex app makes a request.

    But the autofsd daemon will call automount if these is a network change and thus will mount any new drives that become available. The automount can also be configured to unmount a network drive that hasn't been accessed in a specified amount of time. If a directory is referenced on a particular filesystem, then automount can mount it if it is specified in the auto_master configuration file. I don't know exactly what you wish to do here, but there is an automountd plist file in the /System/Library/LaunchDaemons directory. You can do things like mount hidden filesystems so they will be hidden to the Finder. A common use of these daemons is for handling the networked home folders for networked accounts (Open Directory).

    In any case, if you attempt this, your starting point for documentation should be the manpages for autofsd, autofs.conf, automount, automountd, auto_master, configd, scutil, and launchd.

    The network is monitored by the "configd" daemon (although this may change) with the information store accessible through the "scutil" commands.

    Good luck,

Share This Page