On Tue, May 19, 2020 at 10:41 AM François Patte <francois.patte@mi.parisdescartes.fr> wrote:

I have computer A (a desktop) and a computer B (a laptop) and I want to
automatically mount a partition of A on B when B starts.

I use systemd automounts for this. In /etc/fstab on B, something like this:

A:/path/to/mount /path/on/B nfs noauto,rw,x-systemd.automount,x-systemd.idle-timeout=1min,x-systemd.mount-timeout=30     0 0

Generally, just accessing anything under /path/on/B will cause the mount to happen. It will then unmount after 1 minute of nothing accessing /path/on/B. An attempt to access /path/on/B if A is not available will hang for 30 seconds, then report a failure to the accessing application.

This works well for me.