Samba share on Mountain Lion freezes

I'm using a Mac Mini (Mid 2010) with Mountain Lion on (OS X 10.8 12A269 – not OS X Server) as a file server at my home network. The Mac is equipped with an external 2TB USB disk (Western Digital).

The root of the external disk, from here on called extrn, is shared using "File Sharing".

When reading/writing large files from a Windows 7 workstation the entire samba connection seems to freeze for about a minute. It seems like the connection just resets. Sometimes it takes less than a minute.

So my Question is, how do I troubleshoot this problem? What information is needed to solve this? Does anyone have any idea why this is happening?

In the Sharing menu in OS X, the folder is shared as "Read & Write" for my user, my user group and "Everyone". Under Options I've selected Share files and folders using SMB (Windows). And my user is also selected beneath that check box.

Looking at system.log there is a few related lines:

Aug 7 23:01:28 N-Ns-Mac-mini.local digest-service[11674]: label: default
Aug 7 23:01:28 N-Ns-Mac-mini.local digest-service[11674]:     dbname: od:/Local/Default
Aug 7 23:01:28 N-Ns-Mac-mini.local digest-service[11674]:     mkey_file: /var/db/krb5kdc/m-key
Aug 7 23:01:28 N-Ns-Mac-mini.local digest-service[11674]:     acl_file: /var/db/krb5kdc/kadmind.acl
Aug 7 23:01:28 N-Ns-Mac-mini.local digest-service[11674]: digest-request: uid=0
Aug 7 23:01:28 N-Ns-Mac-mini.local digest-service[11674]: digest-request: init request
Aug 7 23:01:28 N-Ns-Mac-mini.local digest-service[11674]: digest-request: init return domain: MACMINI-012345 server: N-NS-MAC-MINI
Aug 7 23:01:28 N-Ns-Mac-mini.local digest-service[11674]: digest-request: uid=0
Aug 7 23:01:28 N-Ns-Mac-mini.local digest-service[11674]: digest-request: init request
Aug 7 23:01:28 N-Ns-Mac-mini.local digest-service[11674]: digest-request: init return domain: MACMINI-012345 server: N-NS-MAC-MINI
Aug 7 23:01:28 N-Ns-Mac-mini.local digest-service[11674]: digest-request: uid=0
Aug 7 23:01:28 N-Ns-Mac-mini.local digest-service[11674]: digest-request: od failed with 2 proto=ntlmv1-with-v2-session
Aug 7 23:01:28 N-Ns-Mac-mini.local digest-service[11674]: digest-request: user=WIN7\username
Aug 7 23:01:28 N-Ns-Mac-mini.local digest-service[11674]: digest-request kdc: ok user=MACMINI-012345\username proto=ntlvm1 flags: NEG_KEYEX, ENC_128, NEG_VERSION, NEG_TARGET_INFO, NEG_NTLM2, NEG_ALWAYS_SIGN, NEG_NTLM, NEG_SIGN, NEG_TARGET, NEG_UNICODE
Aug 7 23:01:28 N-Ns-Mac-mini.local smbd[11591]: MACMINI-012345\username connected to path /Volumes/extrn

Then after about 2 minutes, the same chunck of logs appear again.

Sometimes there is an additional row afterwards:

Aug 7 23:05:10 N-Ns-Mac-mini.local smbd[11591]: MACMINI-012345\username connected to path /var/rpc/ncacn_np

username is the same:

  • MACMINI-012345\username at the server
  • WIN7\username at the client.

The strange thing is that sometimes (about 1 out of 30 times) everything works like a charm. Sometimes the problem is even worse. I can't say that I see any pattern in it.

Any ideas?

UPDATE:

File system is 'Mac OS Extended (Journaled)'. I've also tried to share a folder on the internal drive (320GB included with Mac Mini Mid 2010). The same problem appears there too.

When the system "freeze" I refer to the Windows 7 client. What ever client trying to write the file (e.g. an unzip) gets an error message telling me that the "Path can no longer be found". Or if I'm trying to copy a file the copy progress is aborted due to write error. If I then try to access the drive (or any other samba share at my Mac) nothing happens for a while before everything suddenly works again.


Solution 1:

 Considerations

For the partition, in its entirety, at the server you grant read and write privileges to everyone:

  • may be comparable to guest access, which does not require authentication.

Consider the following possibilities:

  • some communication, or attempted communication, by Windows 7 may be anonymous, without authentication (whether/how such communications would be logged by the server in a non-Server build of the OS, I don't know)
  • writes, or attempted writes, by Windows 7 are inappropriate for something at/around the root of the partition.

Suggestions

Increase the verbosity of logging for SMB

This may be easier to achieve with a Server build of the OS.

Diagnosis at the server when the client perceives a problem

Enable the stackshot daemon then use the key chord for sysdiagnose

Preparation: enable the daemon

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.stackshot.plist

When the problem occurs: use the key chord for sysdiagnose.

For at least ten seconds after the chord, touch nothing.

After Finder brings to front the result of sysdiagnose: decompress the archive, consider the files that comprise the diagnosis.

References

stackshot(1) OS X Manual Page

sysdiagnose(1) OS X Manual Page