[kwlug-disc] Accessing recently-written NFS files

Khalid Baheyeldin kb at 2bits.com
Sat Dec 17 19:03:10 EST 2022


Adam,

Is NFS a must in this case, or can you use other file systems?

The reason I suggest this is that historically NFS have had a problematic
legacy in certain use cases. These include caching inconsistencies in some
use cases.

About a decade ago I investigated how to share file systems across two web
hosts. That was for a web site to share the code and static files on two
web
servers.  NFS was the most problematic, and not practical.

There was GFS (not GFS2) and GlusterFS which showed promise last I looked
at filesystems for the above use case.

For certain types of use, sshfs may be all you need (e.g. mounting server
shares
to my laptop). Have been using it for years without issues. It even
transparently
reconnects after the laptop wakes up from sleep. It does not need a daemon
on
the server (openssh server does it all), which means great security.

All you need is install the sshfs package on the client, and run the
following command:

sudo sshfs -o $OPTS user at host:/remote/file/system /local/mount

The OPTS variable is where all the magic is

IdentityFile=~myname/.ssh/id_ed25519,port=22,follow_symlinks,allow_other,noatime,
idmap=file,uidfile=/etc/sshfs-uids,gidfile=/etc/sshfs-gids,nomap=ignore,
workaround=rename,nonempty,reconnect,ServerAliveInterval=3,
ServerAliveCountMax=10

Besides your ssh private key, two files are needed to map the uid and gid
to what they
are on the server:

user1:1001
user2:1002

users:100
user1:1001
user2:1002

And that is all there is to it.

SSHFS would not work in a high load scenario though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20221217/71ad9a89/attachment.htm>


More information about the kwlug-disc mailing list