I like to have the samba server connected at all times, cos I need my data frequently. However, OS X tends to drop the connection after a certain time.
When this happens, sometimes re-mount fails unless I restart Samba via the GUI.
I mount the shares as follows:
# mount -t smbfs smb://user:pass@ipaddress/sharename /path/to/local/folder
Works well... After this sysctl command would show a couple of kernel variables for samba connections:
# sysctl -a | grep -i smb
net.smb.fs.version: 300064
net.smb.fs.loglevel: 0
net.smb.fs.kern_deadtimer: 60
net.smb.fs.kern_hard_deadtimer: 600
net.smb.fs.kern_soft_deadtimer: 30
net.smb.fs.tcpsndbuf: 4194304
net.smb.fs.tcprcvbuf: 4194304
net.smb.fs.maxwrite: 524288
net.smb.fs.maxread: 1048576
net.smb.fs.maxsegreadsize: 2097152
net.smb.fs.maxsegwritesize: 2097152
I am guessing that the kern_deadtimer, kern_soft_deadtimer and kern_hard_deadtimer are all related to my timeouts, so I zero them out one by one:
$ sudo sysctl net.smb.fs.kern_deadtimer=0
net.smb.fs.kern_deadtimer: 60 -> 0
$ sudo sysctl net.smb.fs.kern_hard_deadtimer=0
net.smb.fs.kern_hard_deadtimer: 600 -> 0
$ sudo sysctl net.smb.fs.kern_soft_deadtimer=0
net.smb.fs.kern_soft_deadtimer: 30 -> 0
This seems to work well and the samba connection stays up

