CIFS VFS no response error? Simple fix.

So pretty much every time I reinstall I create auto-mounts in fstab for my Window's shares using smbfs. One problem that always happens is on shutdown or reboot those shares (using cifs) do not get umounted automatically. I always wind up Google searching and find the same post.

To fix the issue it's quite simple just put a simple script in a few directories and it will detect all your cifs mounts and automatically umount them. The script is written by Max Durden and the original post has these instructions but I'd like to post them here for ease of access for myself.

First create the file called mountcifs

#!/bin/bash
#
# mountcifs - Unmounts samba-cifs filesystems
# -> convenience script to be called in the shutdown/reboot sequence of Ubuntu Dapper 
#    as K02umountcifs
# Written by Max Durden
# max.durden@gmail.com
#

start() {
echo "mountcifs: nothing to do!"
}

stop() {
echo "Unmounting samba-cifs filesystems..."
MOUNTED_CIFS_DIRS=`mount -t cifs| cut -d\  -f3`
MOUNTED_DIRS_ARRAY=($MOUNTED_CIFS_DIRS)
for i in ${!MOUNTED_DIRS_ARRAY[@]}
do
  umount -l ${MOUNTED_DIRS_ARRAY[i]}
done
}

status() {
echo "Mounted samba-cifs filesystems..."
mount -t cifs| cut -d\  -f3
}

restart() {
echo "restart ..."
start
}

reload() {
echo "start ..."
start
}

force_reload() {
echo "force-reload ..."
start
}

case $1 in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
restart
;;
reload)
reload
;;
force-reload)
force_reload
;;
*)
echo "Usage: mountcifs {start|stop|restart|reload|force-reload|status}"
;;
esac

exit 0

Save that to /etc/init.d/ (note: you need to be root) then make it executable.

chmod +x mountcifs

Then create a couple symbolic links so it launches on shutdown or reboot.

sudo ln -s /etc/init.d/mountcifs /etc/rc0.d/K02mountcifs
sudo ln -s /etc/init.d/mountcifs /etc/rc6.d/K02mountcifs

That's it. That stupid error that hangs your PC from shutting down will no longer exist.

Tags: