Automatically Unmount Network Shares on Ubuntu
I’ve mentioned before, how I mount shared drives in Ubuntu both at home and at work. While this is quite useful, it seems the default setup for Ubuntu stops the network interface before disconnecting these drives. This results in Ubuntu hanging for a while on shutdown while these drives time out. After the jump we describe how to solve this problem.
It seems that during the shutdown sequence for Ubuntu, networking will be turned off before any network shares have been unmounted. This will cause your computer to display the following for a few minutes before shutting down:
CIFS VFS: server not responding CIFS VFS: no response for cmd ## mid ###
To fix this problem, and enable the computer to shut down more smoothly, we need to make sure the shares are unmounted before the network is disconected. This can be done by running to following commands:
sudo update-rc.d -f umountnfs.sh remove sudo update-rc.d umountnfs.sh stop 15 0 6 .
This will increase the priority for share unmounting, allowing the shares to be unmounted cleanly, before the network shutdown scripts are run.