How to keep alive (or reconnect) fuse SSHFS mount between sleep/hibernate?
Running Debian GNU/Linux (testing/Squeeze, 2.6.32) with KDE 4.4.5 and Wicd networking, trying to sleep (hibernate to RAM).
I have a laptop that connects to another computer in my house with SSHFS at laptop's login to KDE, to allow Amarok to play music and to allow non-KDE apps to easily open and save files across the network (most KDE apps can natively use sftp:// KIO slave).
When the laptop goes to sleep and then resumes, the three mount points:
sometimes are able to reconnect and sometimes SSHFS (fuse) will hang, preventing any file open/save dialogs from functioning (the wife loves this). When SSHFS hangs, sometimes I am able to manually (CLI) unmount the drives as user, sometimes I must be root to do so.
My current attempts to make this function cleanly are failing. This is what I've tried:
1. Using Wicd's 'scripts' functionality to unmount the drives before disconnection, but I don't know if Wicd knows that Sleep is happening
2. KDE's PowerDevil allows for actions before sleep; I put a script there to unmount the drives before sleep
3. I have Wicd (via 'scripts') try to reconnect the drives after a 5sec delay upon reconnecting to the network, but if the mount points aren't cleanly unmounted this usually causes the hang
4. Sometimes things just seem to hang for no reason.
5. Sometimes everything works just fine.
My mount scripts call for SSHFS to use:
-s disable multi-threaded operation
My unmount (fusermount) scripts use:
-z lazy unmount
and seem to generally work well when I am testing the scripts. It's the Sleep action that seems to be causing most of the issues, as I have a hard time recreating the issue when I am just testing by running the various commands.
Can anyone help me to figure out the best way to make this function? I am not against using /etc/fstab to make these mounts if the ssh mount point can survive the Sleep mode, but I thought that userspace may be better for this (perhaps not).
Earlier today I thought maybe the unmount script could be given UID perms to allow the user account to run root permissions to better unmount these network connections before sleep, but I am not sure yet if that is a good solution or not.
Well it's possible to run sshfs over autofs so that would disconnect the mount when it was idle. I'm not sure if that would be wholly suitable if she likes to slam the lid done immediately after using those files, but aside from the time taken to re-establish the sshfs connection on first use of the mount point, it's a really nice model that makes this sort of thing a non-issue.
autofs to the rescue? I'll get back to you...
> Well it's possible to run sshfs over autofs so that would
> disconnect the mount when it was idle
> ...re-establish the sshfs connection on first use of the
> mount point
That sounds wonderful, I will look into autofs tonight. Thank you so much for the heads up on that, acid_kewpie, and I will post back with results within a few days of testing.
I cannot seem to get autofs to function with sshfs and mDNS (avahi/zeroconf), although the mDNS may have nothing to do with this.
SSH keys (passwordless) are working fine for normal sshfs and ssh operations.
Here is my entry for /etc/auto.master:
Apparently I also needed to add a line to nsswitch.conf:
I restarted /etc/init.d/autofs and no matter what I try, nothing shows up in my directory listings; directories are created if I put the mount point elsewhere (in auto.master such as /mnt/Music ). Am I missing something or have I mis-configured the configs? Are my options outdated? Does mDNS not work to resolve my hostname? Are my sshfs syntaxes wrong (because that is a mess)?
I'm no expert, but maybe try afuse, an automounter for fuse file systems?
This is my first post on linuxquestions.org, so I cannot post links but just google:
|All times are GMT -5. The time now is 01:48 AM.|