6

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.

4
  • I think you just need to unmount the previous mounts using fusermount -u ..., see here: unix.stackexchange.com/questions/91736/….
    – slm
    Commented Jul 17, 2015 at 6:35
  • @slm “Upon reboot, …” there's nothing to unmount. Commented Jul 17, 2015 at 22:58
  • @Gilles - yeah but I believe sshfs leaves files in the filesystem that lead it to believe things are still mounted. I know I've run into this exact issue before and had to use fusermount to clean things up.
    – slm
    Commented Jul 18, 2015 at 0:26
  • I have the same problem. Your trick of using a new mountpoint works well. Thanks
    – Qin Heyang
    Commented Nov 23, 2020 at 17:40

2 Answers 2

1

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

-1

I suspect you just need to unmount your previously mounted, and then broken, sshfs mounts.

$ fusermount --help
fusermount: [options] mountpoint
Options:
 -h         print help
 -V         print version
 -o opt[,opt...]   mount options
 -u         unmount
 -q         quiet
 -z         lazy unmount

You'll want to either do a fusermount -u ... or the fusermount -z.

1
  • Over the past couple weeks, I've tried this and other similar approaches very carefully. No luck. But I have learned a bit more of the behavior. I'm mounting 2 sshfs points, one of them does not have the problem at all, it successfully remounts every time. The other ALWAYS fails, but I only have to cycle back to the previous mount point for it to work. This is a VMware virt machine running Fedora 21 with Windows 7 as the host OS. So reboots are a fact of life. I have tried running the fusermount -u after reboot, no help). Running the fusermount -u after it fails, no help.
    – bfoddy
    Commented Jul 31, 2015 at 19:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .