Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 31

Thread: Automatically mount and unmount shares

  1. #11
    Join Date
    Jan 2008
    Location
    Mumbai, India
    Beans
    128
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: Automatically mount and unmount shares

    I had run the command initially, I think. Anyway I solved the problem. I checked the "automount" file under /etc/init.d and it did not have permission to run as an executable. checked that option and now it is ok. as for the read / write thing, I will try to find on the forum. thanks a lot for your help.
    Ubuntu 12.04LTS Desktop. C2D, 2.2GHz, 1.5 GbRAM
    250Gb HDD with partitions for /root, /home, /swap, /data. Additional 1Tb HDD also installed for backups. Mainly using to backup networked windows shares automatically.

  2. #12
    Join Date
    Dec 2007
    Location
    Manchester, UK
    Beans
    123
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Automatically mount and unmount shares

    This looks very handy for me, but I'm having a few problems. It will mount files when I type a terminal command to do something with automount.conf, the only problem is it wont mount shares at boot. I feel this is a problem to do with my /etc/init.d/automount file, as a Sudo /etc/init.d/automount stop generates the error 'sudo: /etc/init.d/automount: command not found.

    I copied the file exactly as in the original post (in fact, the only change I have made was the network shares in automount.conf to mount my own network share.

    Any ideas on how to remedy this? I presume I've just made a simple mistake which is breaking it all.
    Each time you visit without javascript, another frog dies. YOU are responsible. How does that make you feel? hmm? Save frogs. Enable javascript.
    - Webpigeon, IRC, 2008

  3. #13
    Join Date
    Dec 2006
    Beans
    678

    Re: Automatically mount and unmount shares

    Quote Originally Posted by MunkyJunky View Post
    Any ideas on how to remedy this? I presume I've just made a simple mistake which is breaking it all.
    Chmod 755 the /etc/init.d/automount - it's probably not executable. It appears I forgot that step in the original post and have just updated it.

  4. #14
    Join Date
    Dec 2007
    Location
    Manchester, UK
    Beans
    123
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Automatically mount and unmount shares

    Thanks, that seems to have fixed it. I haven't tried a reboot yet, but I can stop/start it through terminal, which I couldn't before.
    Each time you visit without javascript, another frog dies. YOU are responsible. How does that make you feel? hmm? Save frogs. Enable javascript.
    - Webpigeon, IRC, 2008

  5. #15
    Join Date
    Jun 2008
    Beans
    57

    Re: Automatically mount and unmount shares

    Wondering if someone could give me a hand ... I've followed all the steps in the first post, making sure to make all the required files executable, however, when I try to run:

    sudo /etc/automount.bash start /etc/automount.conf -v

    I get the following error:

    sudo: unable to execute /etc/automount.bash: No such file or directory

    I've double check and tripple checked to make sure that it's set as an executable file, and it is, for the owner, group, and others.

    Any idea what might be up?

    Thanks,
    Harry

    P.S. I'm running Ubuntu Hardy.

    P.P.S. When I try to run the above command without sudo, I get this error:

    bash: /etc/automount.conf: /bin/bash^M: bad interpreter: No such file or directory

    Not sure if it gives anyone any clues as to what might be wrong. Thanks again.
    Last edited by Harry Muscle; June 27th, 2008 at 03:08 PM.

  6. #16
    Join Date
    Dec 2006
    Beans
    678

    Re: Automatically mount and unmount shares

    Could be an apparmor and/or SELinux problem, if you are running either or both (apparmor is default). I've just posted an update to the setup that I've had ready for a few weeks and hadn't gotten around to updating that conforms better to Linux standards. Update your /etc/init.d/automount with the new version I have posted, delete /etc/automount.bash, and create /usr/local/bin/automount from the revised original post. Hopefully that will address the problem, as well as providing a slightly improved setup.

  7. #17
    Join Date
    Apr 2007
    Beans
    8

    Re: Automatically mount and unmount shares

    So I'm not entirely sure whats going on ... but about 1 in 4 of my shares fail to be unmounted when the host goes down using this script. I have a hunch its not a problem with the script itself but rather a problem with cifs. I think its a similar issue to that of the problem some are having with umounts hanging at shutdown (umount times out because network manager shuts down before the share unmounts, then the umount command hangs). According to the man pages for mount.cifs, the soft option (default) specifies that actions should not hang but this option does actually seem to work all that well. I found a posting on the samba list at http://lists.samba.org/archive/linux...ch/001215.html but there was no follow up which makes me believe soft is not actually implemented well and I could not find more recent discussion of the soft option. Anyways -- did you ever have issues with umounts hanging while using your script, if so, did you ever find a resolution?

  8. #18
    Join Date
    Dec 2006
    Beans
    678

    Re: Automatically mount and unmount shares

    Quote Originally Posted by untoldone View Post
    Anyways -- did you ever have issues with umounts hanging while using your script, if so, did you ever find a resolution?
    Your evaluation is fairly accurate. The short answer to your question is "yes I do, and no I haven't," but I may be able to address the problem. I see two types of umount hangs while running this script, both ultimately caused by the long-standing bug in CIFS.

    The first hang is when computer 1 has an active share with computer 2, but computer 2 drops the connection (e.g., when it is turned off), and I shutdown or hibernate computer 1 before the script has had time to call umount; in this case, shutdown leads to the standard hanging umount that takes a minute or two to quit, while hibernate fails (and eventually returns to the desktop), but will be successful once the script makes the umount call. As far as I can tell, the only way to deal with this would be to use a shorter delay (maybe 10 seconds instead of 60) between pings to increase the probability that computer 1 disconnects before you request shutdown; I just live with it, since I don't see it frequently.

    The second case, which I've not extensively examined, may be due to having many shares (> 3-4) active when calling shutdown. I've not spent time sorting this out, because I rarely shutdown (usually I hibernate, where this isn't an issue), and I only occasionally have more than 2 live connections. If you reproducibly see that having 4 shares causes 1 to not disconnect in time, but having 3 works fine, I may be able to tune the script to either umount faster during shutdown or cause it delay the shutdown process until all umounts are complete.

    The real solution, of course, is for the CIFS bug to get fixed, and then I wouldn't need to worry about the shutdown issue at all. However, it doesn't seem likely to be resolved soon.

  9. #19
    Join Date
    Apr 2007
    Beans
    8

    Re: Automatically mount and unmount shares

    Thank for the reply. I'll try to keep track of how often my shares fail to umount over the next month and play around with the number of shares that are checked by the script. This behavior I listed above was actually just what I observed when disconnecting a line between two switches to test the setup (neither computer lost a network connection -- the two computers just lost the ability to communicate with each other). But I will see how this works in everyday use.

  10. #20
    Join Date
    Dec 2004
    Beans
    6

    Re: Automatically mount and unmount shares

    Awesome. This solves so many problems!

    I have a mythbox with a video directory that has SMB mounts to all of the computers in the house. The problem is that those computers aren't always on.

    I wish smbmount would just recognise that the host is down and auto-unmount

    However, this fixes it

    Cool

Page 2 of 4 FirstFirst 1234 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
  •