Our thinking


Configure the macOS Automounter system

macOS continues to maintain a fully-functional and highly reliable Unix automount system. This system allows us to keep network shared folders mounted on a Mac, and make sure that if the connection drops out, then it gets automatically re-established again when needed.

It’s a great solution if you need to, for example, backup files from your local Mac to a file server and the software you’re using doesn’t explicitly allow you to backup to a shared folder. Or, if you need the backups to run when there’s no-one logged in to the Mac, so the network shares can’t be mounted in the Finder. Or, if you want to make sure that the network shared folder is always mounted, even if there are interruptions to the network or the remote server is restarted.

Because I only use this automount system once every few years, I always think that it’s a lot more difficult than it actually is. It’s actually quite simple really, once you get down to it.

Essentially, the automount system relies on a collection of text files sitting in the /etc directory.

The main file is /etc/auto_master – this is the main configuration that tells the automounter what to do. It also refers to other individual resource map files that tell the automounter how to deal with individual folders in the filesystem.

There is already an auto_master file in the /etc folder on your installation of macOS, so you don’t need to create this file – you just add your customisations to the end of it.

You will need to create the individual resource map files, fortunately they are pretty straightforward.

In my example, I will create a /mnt folder at the root level of my hard drive – this is where I will be automatically mounting the remote file systems. Do not use the /Volumes directory – this is used by macOS and strange things will happen if you attempt to automount other file systems in here. In particular, even if you get it working, it will not show up on the Desktop in the Finder as a mounted network share. Just leave it alone and let macOS handle this folder on its own.

I then made a directory in /mnt called backups. This is where I want to dump my backups to, so it should be mounted on the remote server. On my remote server, I have created a shared folder called Backups and made sure I have the credentials for a user account to connect to it.

First I need to edit the auto_master file. To the end of the file I add the following line:

/mnt    resource_map

This tells the automount system that if it is told to do anything with the /mnt directory then consult a file called resource_map which is also in the /etc directory.

Next, I create my resource_map file. This just has one line in it like so:

backups    -fstype=smbfs smb://username:[email protected]/Backups

This tells the automount system to take action on the directory backups (in the /mnt directory). Whenever anyone wants to do anything in this directory, then use the credentials username and Pa$$w0rd to connect to fileserver.example.private and mount the Backups shared folder.

Finally, to make it all take effect run in Terminal:

sudo automount -vc

From now on, whenever you look in /mnt/backups, it will show the contents of the Backups shared folder from the server.

Leave a Reply