10 September 2012

OS X - Do your network shares keep disappearing?

I have a Mac Mini so I can keep in touch with Apple computer technology.

I don't like it a lot - especially with way it plays on a network. For example, mounting a network share and getting the file listing takes less than a second on my old Windows Core 2 Duo, but on my Mac Mini i5 with 8 GB of RAM it takes up to 20 seconds. The same Mac, running Linux inside VMware, takes less than a second - in a virtual machine!!

Anyway, another frustrating thing was I have some iTunes content on a network share, and I'd like iTunes on the Mac to be able to see that content all the time. I set up the startup so that the appropriate network shares auto mounted on login. The trouble is that they kept disappearing after a relatively short time.

After a lot of digging around on the internet, it turns out that Apple has decided that if you don't use a network share for more than 60 minutes it will simply unmount it!  That is truly bizarre. Windows does something very slightly similar by closing the network connection, but it reopens it instantly. This is unlike the Mac OS X system where it trashes the entire connection, requiring human intervention.

Anyway, here's the answer to a problem that shouldn't have occurred:

edit the file:

/etc/autofs.conf

change AUTOMOUNT_TIMEOUT to a large number. It is set for 3600 seconds (1 hour) by default. Restart and you're in business.