How to remount drives which lost connection?

Bo Berglund bo.berglund at gmail.com
Sat Jun 11 20:39:38 UTC 2022


I have a Linux Mint installation which sits on a remote location where the
router provides a VPN connection to my main LAN.
This Mint device seems to sometimes lose connection to an nfs share on the main
LAN defined in fstab as follows:

192.168.119.216:/home/bosse/www/VIDEO /mnt/video nfs tcp,noexec,intr 0 0

What happens is that the share is sometimes not connected when I need to use it
and at those times this command fixes the problem:

sudo mount -a

I would like the system to reconnect if the connection is for some reason lost,
can this be done?

One reason for a loss might be that the nfs server is restarting (it is also the
VPN server so the remote system will temporarily lose connection if the server
reboots).

Otherwise it might not reconnect if the remote side experiences a power glitch
and the VPN connection is not yet established when it tries to mount the fstab
entries. (Today I had such an outage when I accidentally tripped the protective
ground switch while trimming a hedge...)

When a power outage happens both the fiber interface, the router and the Linux
Mint device will start at the same time and I assume that if the Mint system is
faster than the others it will try the mount before the communication is
actually set up and therefore fail...

I understand that I could for instance put an entry in crontab that will run the
sudo mount -a command at say 3 minutes following a reboot, but it would be
better if there is some existing argument or such that can provide the
functionality....


-- 
Bo Berglund
Developer in Sweden





More information about the ubuntu-users mailing list