Page 16 of 21 FirstFirst ... 61415161718 ... LastLast
Results 151 to 160 of 207

Thread: how to: automatically umount cifs partitions

  1. #151
    Join Date
    Jul 2009
    Beans
    1

    Re: how to: automatically umount cifs partitions

    Quote Originally Posted by max.durden View Post
    Hi everybody,
    I'm posting a modification of a simple script originally coded by 'jferrando'
    http://www.ubuntuforums.org/showthre...highlight=cifs
    devoted to automatically umount cifs partitions in the shutdown and reboot sequence of Ubuntu (Dapper+). The main problem with the original script was that mount locations of cifs partitions had to be explicitly hardcoded in the script: I have written a simple routine which detects all mounted cifs-partition and umount them before proceeding with the other phases of the shutdown/reboot sequences.

    -----------------------------------------------------
    Instructions are very simple:
    uncompress archive and set 'chmod +x' on the mountcifs file
    sudo cp mountcifs /etc/init.d/

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

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

    ...that's all!
    ------------------------------------------------------
    I've experienced problem in the shutdown of my laptop just after sharing cifs filesystems with other PCs in a VPN network... this script fixed the problem.... hope it will be useful for someone out there!

    Happy Coding
    Max
    Thanks, works

  2. #152
    Join Date
    May 2007
    Beans
    880
    Distro
    Ubuntu Development Release

    Re: how to: automatically umount cifs partitions

    Folks might consider trying the GVFS method as well:
    http://ubuntuforums.org/showpost.php...09&postcount=1

    It's working beautifully for me so far. The only issue that I've encountered is that programs run as root don't have access to these mounted shares. But all-in-all this seems like a much more graceful and less kludgey way to mount the same shares consistently.

  3. #153
    Join Date
    Jul 2009
    Beans
    3

    Re: how to: automatically umount cifs partitions

    The original link containing the script isn't working: http://www.ubuntuforums.org/showthre...highlight=cifs

    am i doin it wrong?

  4. #154
    Join Date
    Apr 2009
    Beans
    2
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: how to: automatically umount cifs partitions

    Hello,

    I followed pajarraco instructions and it did not work on Ubuntu 9.04. However, if you place
    Code:
    /etc/init.d/umountnfs.sh
    before the line
    Code:
    exit 0
    it works.

    Mike


    Quote Originally Posted by pajarraco View Post
    Thanks kaiben, I used jaunty and this finally fix the error.

    I put this line on my /etc/gdm/PostSession/Default file

    Code:
    /etc/init.d/umountnfs.sh
    after the line
    Code:
    exit 0
    and it fix.

  5. #155
    Join Date
    Aug 2009
    Location
    Krasnoyarsk city
    Beans
    3
    Distro
    Kubuntu Karmic Koala (testing)

    Lightbulb Re: how to: automatically umount cifs partitions

    do not need any scripts!

    just only small modifications:

    # cifs client workaround
    modprobe cifs
    echo 0 > /proc/fs/cifs/OplockEnabled



    source: http://blog.dhampir.no/content/cifs-...-for-cmd-n-mid

  6. #156
    Join Date
    Jul 2009
    Beans
    3

    Re: how to: automatically umount cifs partitions

    Quote Originally Posted by DAKnn View Post
    do not need any scripts!

    just only small modifications:

    # cifs client workaround
    modprobe cifs
    echo 0 > /proc/fs/cifs/OplockEnabled



    source: http://blog.dhampir.no/content/cifs-...-for-cmd-n-mid
    I think this is a different issue. The one you linked seems to be for a file transfer issue. The problem we are having here is when shutting down, network mounts are failing to unmount properly.

  7. #157
    Join Date
    Aug 2009
    Beans
    1

    Re: how to: automatically umount cifs partitions

    Hi,

    I just hacked a little script you can archive, as I think this bug will be in Ubuntu for at least 5 more years. It just automates, what a human would do ^^

    Code:
    #!/bin/bash
    FIX=$(cat <<EOF
    #!/bin/bash
    /etc/init.d/umountnfs.sh
    EOF
    )
    echo "$FIX" >> ./Default
    more +2 /etc/gdm/PostSession/Default >> ./Default
    sudo mv ./Default /etc/gdm/PostSession/Default
    echo "done..."
    It's really just for you, when you want to archive this and reinstall quite often...etc...etc

  8. #158
    Join Date
    Sep 2009
    Beans
    3

    Re: how to: automatically umount cifs partitions

    I'm using Jaunty.

    The solutions I've seen so far:
    1) Adding an extra CIFS umount script (/etc/init.d/mountcifs) and linking to it as /etc/rc0.d/K02mountcifs and /etc/rc6.d/K02mountcifs
    2) Moving the calls /etc/rc?.d/K15umountmfs to K02 or even K01
    3) Adding /etc/init.d/umountnfs.sh to /etc/gdm/PostSession/Default
    4) The GVFS method: Adding a script to Gnome startup that mount the shares by using the gvfs-mount command.

    Solution nr 1 puzzled me because the already available script /etc/init.d/umountnfs.sh is capable of umounting CIFS shares. Why then add another script that does the same?

    Solution nr 2 doesn't work for me. Logs indicated that the network was already shutting down before the umount was performed.

    Solution nr 3 came close: The umountnfs.sh call was done very early, but unfortunately, again looking at the logs, Gnome apparently was at the same sime shutting down the network. Seeing that other people have reported success with this solution I can only assume that wireless networks (my case) are shut down earlier than wired networks.

    Solution nr 4: Haven't tried that, because I want the mount shares accessible for every one and mounted on any directory I desire.

    So I had to come up with another solution that uses the gnome-power-cmd script.
    You may not like it, but it works for me:

    • Add a button to the Gnome panel (or use a keyboard shortcut) that calls a script that calls "sudo /etc/init.d/umountnfs.sh" and "/usr/bin/gnome-power-cmd shutdown".
    • Obviously you'll have to edit the sudoers file (sudo visudo):
      Add at the end of the file the line: "peter ALL=NOPASSWD: UMOUNTNFS" (replace "peter" with your account name)
      Earlier in the sudoers file add: "Cmnd_Alias UMOUNTNFS = /etc/init.d/umountnfs.sh"


    The script I came up with:

    #!/bin/bash
    echo -n "Do you really want to shutdown? Press 'y' to confirm. "
    read -n 1 answer
    echo ""
    if [[ "$answer" = "y" ]]
    then
    echo "Goodbye!"
    sleep 1
    sudo /etc/init.d/umountnfs.sh >/tmp/do_shutdown.sh.log 2>&1
    /usr/bin/gnome-power-cmd shutdown
    else
    echo "Phew! That was close!"
    fi

  9. #159
    Join Date
    Sep 2007
    Location
    The Netherlands
    Beans
    94
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: how to: automatically umount cifs partitions

    ok, i finally solved the CIFS VFS issue, by reordering the shutdown order to

    K01umountnfs.sh
    K02gdm
    K03usplash

    in both /etc/rc0.d and /etc/rc6.d like it says way back in this thread

    it shuts down like lightning now 8)

    just one minor problem...
    the shutdown splash won't kick in.
    i do prefer function over pretty, but the feeling i broke something nags me

    anyone know how to fix this one?

  10. #160
    Join Date
    Apr 2005
    Beans
    319
    Distro
    Kubuntu 10.10 Maverick Meerkat

    Re: how to: automatically umount cifs partitions

    Quote Originally Posted by Yougo View Post
    ok, i finally solved the CIFS VFS issue, by reordering the shutdown order to

    K01umountnfs.sh
    K02gdm
    K03usplash

    in both /etc/rc0.d and /etc/rc6.d like it says way back in this thread

    it shuts down like lightning now 8)

    just one minor problem...
    the shutdown splash won't kick in.
    i do prefer function over pretty, but the feeling i broke something nags me

    anyone know how to fix this one?
    Can you please provide a more elaborate post on how you were able to solve this problem? I am having the same problem with my install, and it is really quite annoying.

Page 16 of 21 FirstFirst ... 61415161718 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •