osxfuse / sshfs

File system based on the SSH File Transfer Protocol
http://fuse.sourceforge.net
GNU General Public License v2.0
1.17k stars 130 forks source link

How to unmount sshfs mounted on FUSE filesystem #67

Open artgoldberg opened 3 years ago

artgoldberg commented 3 years ago

Hello sshfs

Following the directions in SSHFS, I've mounted a remote directory on a local directory.

The line in the mount table is

uid@xxx:/var/opt/leafapi/ on /Users/arthur_at_sinai/gitOnMyLaptopLocal/sc_repos/leafapi_on_vm (macfuse, nodev, nosuid, synchronous, mounted by arthur_at_sinai)

The connection has gone stale and I'd like to remount it. Reissuing this command

sshfs uid@xxx:/var/opt/leafapi/ ~/gitOnMyLaptopLocal/sc_repos/leafapi_on_vm

generates

mount_macfuse: mount point /Users/arthur_at_sinai/gitOnMyLaptopLocal/sc_repos/leafapi_on_vm is itself on a macFUSE volume

But various attempts to use umount fail. E.g.,

umount /Users/arthur_at_sinai/gitOnMyLaptopLocal/sc_repos/leafapi_on_vm

generates

umount(/Users/arthur_at_sinai/gitOnMyLaptopLocal/sc_repos/leafapi_on_vm): Resource busy -- try 'diskutil unmount'

And diskutil unmount says:

Unmount failed for uid@xxx:/var/opt/leafapi/

Running macOS Big Sur.

Assistance would be greatly appreciate.

Arthur

artgoldberg commented 3 years ago

Still a problem.

artgoldberg commented 3 years ago

Folks, if you're running into this, and easy workaround is to just create a new mount point. E.g., if ~/local_dir is still mounted, instead of

sshfs uid@xxx:/remote/dir ~/local_dir

execute

sshfs uid@xxx:/remote/dir ~/local_dir_2

Eventually -- and certainly after rebooting -- the mount points will be released.

poetaman commented 3 years ago

@artgoldberg If you run unmount from within a mounted directory then it will fail with this for sure. Not sure what other cases would lead to that.

ToeKneeFan commented 2 years ago

Maybe this is obvious, but if the resource is being used by some process (that is, the resource is actually busy), then that could prevent the unmount. Remounting a stale sshfs mount is unfortunately a little cumbersome (close/kill any processes using that node, sudo umount manually, then remount with sshfs).

dantiel commented 2 years ago

i have often problem with hanging volumes. at least in this case umount -f /sshdir worked for me and allowed remount at the same node