SMB: auto-unmount then unable to re-mount without restart

mountsmb

I have a recurring problem with mounting/un-mounting remote directories via SMB, however I don't know what triggers the problem nor how to resolve it.

Background:

After successfully mounting the directory via SMB and some time using it, the directory seems to unmount by itself. When this happens, I am unable to re-mount the directory until I restart my system.

If I don't restart the system and use the "Connect to Server" dialog to try to mount the directory via SMB, the dialog disappears as though the connection was successful, however nothing is mounted.

If I try to do the same thing with a parent directory (which is the root directory of the server), then the connection appears to be successful and prompts me to "Select the volumes you want to mount on 'xyz.server.name':" with a listing of directories. The directory that I previously mounted (which auto-unmounted) is listed, but is ghosted out and therefore unable to be selected.

When SSH-ing into the server, there does not appear to be any problem with accessing the directory.

This problem occurs for other remote directories as well (though I have not been able to test it on another server).

Also, when trying to reconnect under this scenario, Console reports the following issue:

"30/10/2014 11:48:20.520 am NetAuthSysAgent[3346]: smb_mount: mount failed to my.server.com/mydirectory, syserr = File exists"

Questions:

i) What is causing the directory/volume to be unmounted?

ii) How can I prevent the auto-unmount from happening?

iii) If an auto-unmount occurs, how can I re-mount the directory without restarting?

System details:

OS X 10.9.5

Retina, 15-inch, Early 2013

Server details:

Red Hat Enterprise Linux Server release 5.11 (Tikanga)

Kernel version 2.6.18-371.8.1.el5

Output of df:

Before problem:

Filesystem                                        512-blocks        Used  Available Capacity   iused      ifree %iused  Mounted on
/dev/disk0s2                                       975425848   899360656   75553192    93% 112484080    9444149   92%   /
devfs                                                    371         371          0   100%       644          0  100%   /dev
map -hosts                                                 0           0          0   100%         0          0  100%   /net
map auto_home                                              0           0          0   100%         0          0  100%   /home
//josh@example.com/josh                          10568950416 10486471008   82479408   100%         0 18446744073709551615    0%   /Volumes/josh
//josh@example.com/semantic                      12682735248  7708953400 4973781848    61%         0 18446744073709551615    0%   /Volumes/semantic

After problem:

Filesystem                                        512-blocks        Used  Available Capacity   iused      ifree %iused  Mounted on
/dev/disk0s2                                       975425848   899350976   75562872    93% 112482870    9445359   92%   /
devfs                                                    373         373          0   100%       648          0  100%   /dev
map -hosts                                                 0           0          0   100%         0          0  100%   /net
map auto_home                                              0           0          0   100%         0          0  100%   /home
//josh@example.com/josh                          10568950416 10466951592  101998824   100%         0 18446744073709551615    0%   /Volumes/josh
//josh@example.com/semantic                      12682735248  7708953400 4973781848    61%         0 18446744073709551615    0%   /Volumes/semantic

Observations:

The mounted directories are still listed in /Volumes when viewed from the terminal, (i.e. 'ls /Volumes'), though this is not always the case, but both directories are inaccessible. They are not visible within Finder at all.

However, I am able to still access the content of one of the directories from Matlab, which was already within a subdirectory of this directory (its working directory). If I then move outside of the directory in Matlab (say, to my home directory), I am unable to return to it via the 'cd' command but instead need to press the back button within the file navigation toolbar and then everything is accessible again from within Matlab.

Best Answer

I'm going to put up an answer to question 3. Not sure the rest can be easily diagnosed.

"If an auto-unmount occurs, how can I re-mount the directory without restarting?"

Try diskutil umount /Volumes/josh and it should do the trick.

The "File exists" error is showing up because the mount point it wants to use is already present. Looks like the disk isn't actually unmounted, just that Finder can't see it. This is why Matlab can still access the files on it.