OS X and Samba

One basic tenant of being a SysAdmin is that you must have some form of home server. Whether that’s an old Atari system that you hacked an ethernet interface onto is irrelevant. Following this tenant, I too run a home server, and one of it’s functions is to provide large file storage for the network. Archives of photos, music, movies, etc.

Samba is a open source bit of software that helps Linux computers interact with and provide file shares using the same protocol that Windows computers use. Apple originally also included Samba in OS X to support connecting to and providing these shares as well, but though various reasons that don’t really matter they decided to make their own version.

There has been quite a lot of discussion regarding performance gains/losses after Apple’s move to their own software for these services, but I had noticed particular problems after upgrading to OS X 10.9, and those problems continued in 10.10. Accessing shares was at times ludicrously slow, sometimes taking upwards of a minute just to show a directory with a dozen files in it.

However, it wasn’t the server, Linux or Windows clients were very responsive and worked well. So, it had to be something about how OS X was interacting with the server that caused problems.

Some internet posts suggested forcing a protocol downgrade by specifying ‘cifs://servername/sharename’ instead of the more usual ‘smb://servername/sharename’. I tried this, along with various permutations of config options on the server side to try and get OS X’s client to perform better. However, none of them seemed to really resolve the issue.

Eventually I found that OS X’s search function, Spotlight, indexes all connected devices, including network shares, by default. Spotlight was trying to access a million (hyperbole) files at once, and causing any other requests to be significantly delayed.

I’m not sure why it indexes things by default, but here’s how I turned it off.

Go to the Apple Menu -> System Preferences -> Spotlight. Click on the Privacy tab, and click the + button to add your Samba share.

Doing this didn’t immediately stop spotlight from indexing the drive, but after a restart the issue was gone, and it doesn’t appear to have recurred in the last few days.

Hope this helps the apparently significant number of people facing this (based on the number of people complaining about Samba performance on OS X in the google results).

This entry was posted in Electronics, Technology. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *