There are a number of posts on Stack Exchange sites related to the problem in the title, but none seems to offer a great solution. I guess this post is a shameless attempt to solve the problem (some of the others are some years old now) and see if anyone has a good solution for this. I am thinking that perhaps a proven combination of options provided to autofs, as opposed to some solution / monitoring script.
I just raised this as a problem against SSHFS, but apparently there are no current maintainers …
To echo the content of the error report, as I know, people prefer not to rely on possibly ephemral external links:
——— START PASTA ———
I suspect that this problem is known / understood, but I cannot find an open problem for him.
This has been a problem for me for some time now, and chasing threads in Stack Overflow and the like (look for sshfs "The transport endpoint is not connected") suggests that this is a problem of years that has never been addressed. I don't know if the solution would be in sshfs or elsewhere, but I think it is quite reasonable to wait for an attempt to reconnect if the reconnection option has been passed and the mount point is no longer available.
The problem seems to be when the assembly is still listed in
mount, but there is no process for this in sshfs, for example:
Note that while I have changed some users / routes to maintain anonymity, the problem is exactly as described, that is, both mount points, the one that currently works and the one that currently does not, are adjacent to both the server and in the client (so you can wait for them to work or fail together, but they don't).
data1 -fstype=fuse,port=22,rw,nodev,nonempty,noatime,allow_other,max_read=65536,reconnect,workaround=all,ServerAliveInterval=15,ServerAliveCountMax=3 :sshfs#user@server1:/storage/data1
data2 -fstype=fuse,port=22,rw,nodev,nonempty,noatime,allow_other,max_read=65536,reconnect,workaround=all,ServerAliveInterval=15,ServerAliveCountMax=3 :sshfs#user@server1:/storage/data2
Output of the assembly command:
mount | grep server1
user@server1:/storage/data1 on /mnt/sshfs/data1 type fuse.sshfs (rw,nodev,noatime,user_id=0,group_id=0,allow_other)
user@server1:/storage/data2 on /mnt/sshfs/data2 type fuse.sshfs (rw,nodev,noatime,user_id=0,group_id=0,allow_other)
Autofs status (note the absence of the data2 mount point specified above):
user@serverx:/home/user# systemctl status autofs
● autofs.service - Automounts filesystems on demand
Loaded: loaded (/lib/systemd/system/autofs.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2019-10-23 14:46:52 UTC; 2 months 13 days ago
Main PID: 8524 (automount)
Tasks: 17 (limit: 4915)
CPU: 18h 19min 6.124s
├─8524 /usr/sbin/automount --pid-file /var/run/autofs.pid
├─8718 ssh -X -a -oClearAllForwardings=yes -oport=22 -oServerAliveInterval=15 -oServerAliveCountMax=3 -2 user@server1 -s sftp
└─8755 sshfs user@server1:/storage/data1 /mnt/sshfs/data1 -o rw,nodev,noatime,uid=0,gid=0,port=22,nonempty,allow_other,max_read=65536,reconnect,workaround=(truncated by terminal)
umount / mnt / sshfs / data2, then try
ls from the same directory, the volume is reassembled automatically. But without him
ls (here from the parent directory) produces:
user@serverx:/home/user# ls -l /mnt/sshfs/
ls: cannot access '/mnt/sshfs/data2': Transport endpoint is not connected
drwxr-xr-x 1 root root 4096 Jul 22 11:46 data1
d????????? ? ? ? ? ? data2
So why does the volume not reassemble automatically, when access attempts return "unconnected" errors?
——— FINAL PASTA ———