unmount samba shares during shutdown

Asked by Udo Eisenbarth on 2008-05-10

Hi,

I have mounted smb/cifs share automatically during startup of Ubuntu with an entry in fstab. Startup and working with this setup works quite well. However a problem occurs during shutdown. It looks to me that the network connection is shut down BEFORE the smb share is unmounted. Therefore the system hangs during shutdown until a timeout occurs.
If I manually unmount the share before shutting down everythings works fine.
The question is: What should I change in order to get the share unmounted before the network connection is shut down?

Regards,

Udo Eisenbarth

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
2008-05-10
Last reply:
2008-05-10
Ralph Janke (txwikinger) said : #1

Thanks for this question.

I have created a bug report for this.

I hope this helps.

Well, here's a work-round: I created a script called "cifs" in /etc/init.d that contains the following:

#! /bin/sh

PATH=/sbin:/bin
. /lib/init/vars.sh

. /lib/lsb/init-functions
. /lib/init/mount-functions.sh

if [ -r /etc/default/locale ]; then
        . /etc/default/locale
        export LANG
fi

do_start() {
           log_action_msg "Mounting CIFS filesystems"
           mount -t cifs //edmini.local/family /mnt/family -ouser=me,password=secret
}

do_stop() {
 umount /mnt/family
}

case "$1" in
  start|"")
        do_start
        ;;
  restart|reload|force-reload)
        echo "Error: argument '$1' not supported" >&2
        exit 3
        ;;
  stop)
        do_stop
        ;;
  *)
        echo "Usage: cifs [start|stop]" >&2
        exit 3
        ;;
esac

You just have to make sure the script gets called at the right times during startup and shutdown... I'm still working on that bit!

Can you help with this problem?

Provide an answer of your own, or ask Udo Eisenbarth for more information if necessary.

To post a message you must log in.