On my laptop I wanted to mount some shared directories (via samba), located on my office network and accessible trough OpenVPN. I need them to work remotely (there is in my office local development server, used from all my colleagues). Connecting to the VPN and mounting the shares was straightforward. I just have had to install smbfs (Samba file system utilities) and put the following line in my /etc/fstab:
//192.168.91.1/deals /mnt/deals-old cifs credentials=/etc/samba/deals-user,noexec,noperm 0 0
/etc/samba/deals-user file contains my samba credentials, written this way:
So the samba path is //192.168.91.1/deals and /mnt/deals-old is the local directory (on my laptop’s file system) where I wanted to mount it to. cifs is the filetype and ro means read-only. I am not going to describe the whole process in details, because it’s already pretty well explained here.
Now comes the annoying part! Every time I had to reboot my computer it would give me an error message like this and take forever to disconnect the mount(s) :
CIFS VFS: Server not responding
CIFS VFS: no response for cmd 50 mid 30
Probably because the wireless connection already was terminated but the samba mounts not… Fortunately, thanks to whereofwecannotspeak, I found a solution 🙂
“To unmount Samba shares before shutting down network services, run the following commands as root”
ln -s /etc/init.d/umountnfs.sh /etc/rc0.d/K15umountnfs.sh ln -s /etc/init.d/umountnfs.sh /etc/rc6.d/K15umountnfs.sh
Et voilà, the errors were gone!
But, if you do not always have Internet/VPN connection and your network shares are not always available, better use autofs – it automatically maps samba shares when they are needed.