CIFS supports leases. That is, hosts will try to ask for exclusive access to a file, so that they can assume that it hasn’t changed.
IIRC sshfs just doesn’t care much about cache coherency across hosts and just kind of assumes that things haven’t changed underfoot, uses a timer to expire the cache.
considers
Honestly, with inotify, it’d probably be possible to make a newer sshfs that does support leases.
I suspect that the Unixy thing to do is to use NFSv4 which also does cache coherency correctly.
It is easy to deploy sshfs, though, so I do appreciate why people use it; I do so myself.
kagis to see if anyone has benchmarks
https://blog.ja-ke.tech/2019/08/27/nas-performance-sshfs-nfs-smb.html
Here are some 2019 benchmarks that show NFSv4 to generally be the most-performant.
The really obnoxious thing about NFSv4, IMHO, is that ssh is pretty trivial to set up, and sshfs just requires a working ssh connection and sshfs software installed, whereas if you want secure NFSv4, you need to set up Kerberos. Setting up Kerberos is a pain. It’s great for large organizations, but for “I have three computers that I want to make talk together”, it’s just overkill.
EDIT: I’d also add that I kind of wish that Linux authentication were somewhat more-unified in general in 2024. You’ve got:
-
SSH keys (ssh, sshfs, mosh, tunneling network traffic over ssh connections).
-
/etc/shadow passwords (the above with ssh, plus plenty of other services like CUPS).
-
Wireguard keys
-
GPG keys (email, git commits)
-
X.509 certs (email, TLS, smartcard applications)
-
Kerberos (NFSv4, CIFS at least optionally)
Then you’ve got various keyrings and credential caches, like ssh-agent
, gpg-agent
, Gnome has some keyring that can wrap ssh-agent, web browsers have a keyring…
I mean, there’s kind of a lot of overlap among all these. Maybe one system would be too far, but I’d kind of like to have things more-unified than they are today.
EDIT2: Apparently inotify() doesn’t let one block the operation that one is monitoring, so probably can’t use it to implement leases.
If I need to do an emergency boot from a USB stick to repair something that can’t boot, which it sounds like is what you’re after, pretty much any Linux distro will do. I’d probably rather have a single, mainstream bootable OS than a handful.
I’d use Debian, just because that’s what I use normally, so I’m most familiar with it. But it really doesn’t matter all that much.
And honestly, while having an emergency bootable medium with a functioning system can simplify things, if you’re familiar with the boot process, you very rarely actually need emergency boot media on a Linux system. You have a pretty flexible bootloader in grub, and the Linux kernel can run and be usable enough to fix things on a pretty broken system, if you pass something like
init=/bin/sh
to the kernel, maybe busybox instead for a really broken system, and can remount root read-write (mount -o rw,remount /
) and know how to force syncs (echo s > /proc/sysrq-trigger
) and reboots (echo b > /proc/sysrq-trigger
).I’ve killed ld.so and libc before and broght back systems without alternate boot media. The only time I think you’d likely really get into trouble truly requiring alternate boot media is (a) installing a new kernel that doesn’t work for some reason and removing all the old, working kernels before checking to see that your new one works, or (b) killing grub. Maybe if you hork up your partition table or root filesystem enough that grub can’t bring the kernel up, but in most of those cases, I’m not sure that you’re likely gonna be bringing things back up with rescue tools – you’re probably gonna need to reinstall your OS anyway.
EDIT: Well, okay, if you wipe the partition table, I guess that you might be able to find the beginning of a filesystem partition based on magic strings or something and either manually reconstruct the partition table or at least extract a copy of the filesystem to somewhere else.