1

I have a Linux guest on my Mac host that I mount a folder from with sshfs.

My workflow is that I turn on the VM in VirtualBox, connect with sshfs with sshfs max@vm:/home/max/scripts/ ~/vm/ -o defer_permissions -o volname=VM, and when I'm ready I unmount with umount ~/vm.

Sometimes I forgot to unmount before turning of the VM, which results in the terminal session freezing until I turn on the VM again, or me having to kill the process and force unmount the volume, as described here.

I don't care about reconnecting to this specific VM as it's on my local machine and always should work, so I'd like to to unmount directly, or at least after some seconds of inactivity. I have checked sshfs -h but didn't find any obvious flag for this behavior, or should the behavior be configured elsewhere (osxfuse, macOS system, etc)?

Max
  • 207
  • 1
  • 11
  • Perhaps you could add the script to unmount the sshfs onto your list of shutdown scripts on your Linux guest? So that when you shut it down, it runs the unmounter. This won't work if you forcibly power off your guest, though. – QuickishFM Mar 05 '19 at 22:15
  • The guest can't have access to the volumes on the host? I maybe could kill the ssh connection, but that wouldn't help me. Or am I missing something? I tend to start the VM in headless state, and the shutdown is generally down forcibly from VirtualBox. – Max Mar 05 '19 at 22:20
  • Ah, I see. Since you force down the guest, theres nothing you could do from the guest side that could make it work then, since from the Linux box perspective it could die at any minute. Maybe killing ssh is your only option... – QuickishFM Mar 05 '19 at 22:21
  • But even if I kill the ssh server service on the guest I should get the same problem on the host? I haven't tried it though. – Max Mar 06 '19 at 06:39
  • See also: [ssh - How to avoid sshfs freezing? - Super User](https://superuser.com/questions/443878/how-to-avoid-sshfs-freezing) – user202729 May 12 '22 at 01:57

0 Answers0