Automatically Unmount Network Shares on Ubuntu


Hard disk dissection

Hard disk dissection

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.

Advertisements

Tags: , , , ,

3 responses to “Automatically Unmount Network Shares on Ubuntu”

  1. Helen says :

    Nice Post, i like the article in your blog…
    i will visit this blog more often…
    Nice info in there…

    specially about
    Automatically Unmount Network Shares on Ubuntu

    cheers

  2. Nancy Lopez says :

    T tried your command but it won’t work. Does it work with any OS version ?

  3. David says :

    Thanks a million, ever since auto mounting our soho file server to my netbook the netbook was taking forever to shut down, your instructions solved it, thank you!

    David

%d bloggers like this: