NFS with roaming laptops

I’ve configured an NSF share on my laptops using systemd automount feature. This configuration works fine, the share is unmounted after 1m due to the ‘TimeoutIdleSec=60’ definition in the .automount file.

Problem is when these laptops are disconnected from the network, as it obviously loses the connectivity with the NFS server. For example, opening the file manager (thunar) or trying to run an ‘ls’ will freeze the application or terminal because it is trying to reach the NFS server. So, how can I handle this ‘roaming’ situations in an automated way? I mean, whenever the laptops are disconnected from this network avoid at all the NFS share.

TIA

I’ll suggest to read from here on NFS - ArchWiki as you have 3 options to deal with automatic mount handling when the NFS host becomes unreachable.

pehaps a condition in your automount - like

ConditionPathExists=nfs.server:/share

Thanks both of you for your replies; I will check them later today