Page 5 of 21 FirstFirst ... 3456715 ... LastLast
Results 41 to 50 of 207

Thread: how to: automatically umount cifs partitions

  1. #41
    Join Date
    Jun 2007
    Beans
    9

    Re: how to: automatically umount cifs partitions

    Quote Originally Posted by sander marechal View Post
    There is a very simple reason why you cannot simply move umountnfs to S17: What about people who load system directories or home directories from a network share? unmounting those at S17 is too soon. There may still me applications running that use them.

    By the way, you said the script doesn't always work. Which one? The mountcifs script posted by the creator of this thread? Or the umountcifs I posted a couple of posts above? They both work in very different ways.
    Kanji was right; I experienced this behaviour:

    On 7.04: the first post script worked for me without any other modification
    On 7.10: the first post script did not work, dunno why, but Kanji solution worked (but I don't know if it would work without first post script, that I've already installed before modifying S30)

    Anyway, it seems to cause no problem w/ my system, so thanks and cheers

    Massimo

  2. #42
    Join Date
    Apr 2007
    Location
    Pittsburgh PA, USA
    Beans
    376
    Distro
    Ubuntu

    Re: how to: automatically umount cifs partitions

    All,

    I scripted the install using the code provided by the brilliant folks earlier in the post. Just thought i'd share this for the lazy fellows like me!

    Just extract and give it permissions to execute.
    Attached Files Attached Files

  3. #43
    Join Date
    Nov 2007
    Beans
    19

    Re: how to: automatically umount cifs partitions

    why all the trouble when you can just put the mount command into /etc/rc.local files? This file will be executed last during bootup. It works for my smbfs mount.

  4. #44
    Join Date
    Jun 2007
    Beans
    5

    Re: how to: automatically umount cifs partitions

    The following two commands should take care of unmounting Samba shares and other virtual filesystems before a shutdown or reboot. They must be run as root; prefix them with "sudo" if you haven't set up your root account:

    Code:
    ln -s /etc/init.d/umountnfs.sh /etc/rc0.d/K15umountnfs.sh
    ln -s /etc/init.d/umountnfs.sh /etc/rc6.d/K15umountnfs.sh
    More explanation can be found here:

    Unmount Samba filesystems before shutdown or reboot
    .

    Hopefully, this will avoid the need to download and install a separate script, as some other people have suggested. All the tools you need are already built into the Debian/Ubuntu init system.

  5. #45
    Join Date
    Dec 2007
    Beans
    102

    Re: how to: automatically umount cifs partitions

    I just did this:

    sudo nano /etc/init.d/umountnfs.sh
    Code:
    #! /bin/sh
    #
    # umountnfs.sh	Unmount all network filesystems.
    #
    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    
    # Write a reboot record to /var/log/wtmp before unmounting
    halt -w
    
    # Ensure /proc is mounted
    test -r /proc/mounts || mount -t proc proc /proc
    
    echo "Unmounting remote filesystems..."
    
    #
    # Read the list of mounted file systems and -f umount the
    # known network file systems.  -f says umount it even if
    # the server is unreachable.  Do not attempt to umount
    # the root file system.  Unmount in reverse order from
    # that given by /proc/mounts (otherwise it may not work).
    #
    unmount() {
    	local dev mp type opts
    	if read dev mp type opts
    	then
    		# recurse - unmount later items
    		unmount
    		# skip /, /proc and /dev
    		case "$mp" in
    		/|/proc)return 0;;
    		/dev)	return 0;;
    		esac
    		# then unmount this, if nfs
    		case "$type" in
    		nfs|smbfs|ncpfs|cifs) umount -f "$mp";;
    		esac
    	fi
    }
    
    unmount </proc/mounts
    I just added "|cifs" of the types that it should unmount and changed the symlinks in /etc/rc0.d and /etc/rc6.d from S31umountnfs to K15umountnfs. Works like a charm! (Don't forget "sudo chmod +x /etc/init.d/umountnfs.sh")

  6. #46
    Join Date
    Aug 2006
    Location
    Geneva, Switzerland
    Beans
    93
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: how to: automatically umount cifs partitions

    Quote Originally Posted by wyley.r View Post
    The following two commands should take care of unmounting Samba shares and other virtual filesystems before a shutdown or reboot. They must be run as root; prefix them with "sudo" if you haven't set up your root account:

    Code:
    ln -s /etc/init.d/umountnfs.sh /etc/rc0.d/K15umountnfs.sh
    ln -s /etc/init.d/umountnfs.sh /etc/rc6.d/K15umountnfs.sh
    More explanation can be found here:

    Unmount Samba filesystems before shutdown or reboot
    .

    Hopefully, this will avoid the need to download and install a separate script, as some other people have suggested. All the tools you need are already built into the Debian/Ubuntu init system.
    It worked for me. I prefer to create some symbolic links instead of creating/modifying files, so I tried your solution; I was inspired

  7. #47
    Join Date
    Feb 2006
    Location
    Nebraska, USA
    Beans
    17
    Distro
    Ubuntu 6.10 Edgy

    Re: how to: automatically umount cifs partitions

    Thank you Max Durden. Your script worked beautifully. The implementation was pretty an 'I just believe' episode, as I really don't understand the bootup and shutdown sequence nearly as well as I should. Hopefully, someone will incorporate a fix to the distribution soon so the user isn't forced to the command line. Like it or not folks, it's the only way you'll ever pry the average computer away from Micro$oft Window$.

  8. #48
    Join Date
    Feb 2007
    Location
    New Zealand
    Beans
    827
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: how to: automatically umount cifs partitions

    Quote Originally Posted by wyley.r View Post
    More explanation can be found here:

    Unmount Samba filesystems before shutdown or reboot
    .
    This link doesn't seem to work for me, is this a temporary issue?

    EDIT: was obviously temporary, is now working. Thanks wyleyr.
    Last edited by veloce; January 16th, 2008 at 09:06 PM. Reason: New information
    Veloce
    Ubuntu 9.04 64bit on Dell Vostro 1510, Core2 Duo T8100, Nvidia 8400M , Intel 1395 Wireless.
    OK: Wireless, kvm, Canon irc2880, Synergy.

  9. #49
    Join Date
    Feb 2007
    Location
    New Zealand
    Beans
    827
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: how to: automatically umount cifs partitions

    Quote Originally Posted by wyley.r View Post
    The following two commands should take care of unmounting Samba shares and other virtual filesystems before a shutdown or reboot. They must be run as root; prefix them with "sudo" if you haven't set up your root account:

    Code:
    ln -s /etc/init.d/umountnfs.sh /etc/rc0.d/K15umountnfs.sh
    ln -s /etc/init.d/umountnfs.sh /etc/rc6.d/K15umountnfs.sh
    More explanation can be found here:

    Unmount Samba filesystems before shutdown or reboot
    .

    Hopefully, this will avoid the need to download and install a separate script, as some other people have suggested. All the tools you need are already built into the Debian/Ubuntu init system.
    In Gutsy at least, there are already links to these files in these directories, they just start with S31 rather than K15. Tidiest option is just to change their names. I did it using "gksudo nautilus" and browsing to the directory.
    Veloce
    Ubuntu 9.04 64bit on Dell Vostro 1510, Core2 Duo T8100, Nvidia 8400M , Intel 1395 Wireless.
    OK: Wireless, kvm, Canon irc2880, Synergy.

  10. #50
    MountainX's Avatar
    MountainX is offline Iced Blended Vanilla Crème Ubuntu
    Join Date
    Jan 2008
    Location
    A place with no mountains
    Beans
    1,610
    Distro
    Kubuntu

    Re: how to: automatically umount cifs partitions

    veloce's renaming solution seems to work in Hardy beta too.

    BTW, don't use gedit if you are editing files on network shares. I kept thinking I wasn't setting up my shares correctly, but the problem was in gedit all along.

    https://bugs.launchpad.net/gedit/+bug/34813

    The diagnosis is described in these two comments here:
    https://bugs.launchpad.net/ubuntu/+s...13/comments/20
    https://bugs.launchpad.net/ubuntu/+s...13/comments/40
    Last edited by MountainX; March 27th, 2008 at 06:08 PM. Reason: clarified
    Desktop: KX Studio (Kubuntu 12.04)
    Laptop & Netbook: Kubuntu 12.04
    Tablet: Samsung Galaxy Tab 10.1
    Phone: Nexus 4 Cyanogenmod

Page 5 of 21 FirstFirst ... 3456715 ... 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
  •