I have several directories mounted through sshfs. I sometimes get disconnects from the server (not configurable by me). I usually mount the directories like this
sshfs [email protected]:/home/user /mnt/example
When a server disconnects, the sshfs subsystem doesn't umount / free the directory but instead locks it inaccessible. The mount is still visible when typing mount
. When I type
ls /mnt/example
the process gets locked (also Ctrl+c doesn't help). I therefore do
sudo umount -l /mnt/example
# find pid of corresponding process:
ps aux | grep example.com
kill -9 <pid of locked sshfs process>
Is there a better way to deal with this? Obviously sshfs should do the umount and clean up... Ideally it would reconnect automatically.