Sshfs remount hangs

linuxsshfs

On Fedora 21 current patches, in a local LAN environment, I'm mounting 2 filesystems with sshfs. The remote server is on a reliable LAN network, the ssh keys are correctly setup for passwordless login.

So I create an empty directory in my home dir (which is a local filesystem), mount with:

sshfs -o default_permissions me@remoteserver:/mntpoint /home/me/mountdir

The connection works fine and is very stable, performs well, no complaints. Then maybe the local machine reboots or something unexpected happens so the connection is broken ungracefully.

Upon reboot, restart, re-attempt, the same command above will hang … indefinitely. If I control-C it and fusermount -u it, it appears to clean up, but still cannot remount. But the weird thing: if I specify a new mount point in my home directory, it works perfectly again (same remote point). Works perfectly again until something happens and I have to start all over again.

Reboots of the local machine will not clear it. The mount directory is verified empty, I've even removed the mount point directory and recreated the same name… Nope.

Eventually after some trigger, I can go back to an old mount point. So I end up having about 3-4 dirs like:

/home/me/mount.1
/home/me/mount.2
...
/home/me/mount.4

before I can go back to mount.1.

Sometimes it works the first time, especially if I properly unmount it, but most of the time it doesn't.

Any ideas of how to clear whatever sshfs is holding. I can't find anything in any /etc file.

Totally frustrated.

Best Answer

Have you tried "killall sshfs"? That always works for me. Of course if you have more than one, you might want to narrow it down (ps -ef f) + (kill ###). You might need to kill[all] "-9" ###.

I've found that certain unclean umounts leave the process running and tie up the sshfs system (or at least that directory) until the process is killed. (Sometimes, there's an "ssh" job forked from an sshfs, identifiable by a number of command line parameters including "ClearAllForwardings", as well as sshfs jobs)

Fractal