Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

mounting a network NFS share as background task Stretch

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
k829king
Posts: 133
Joined: 2018-08-26 09:47

mounting a network NFS share as background task Stretch

#1 Post by k829king »

In Debian Stretch that runs console only, if I add an network NFS share in fstab the boot process sits there waiting for (90seconds?) trying to mount the network share if it's unavailable before giving up and the boot process finishing and arriving at prompt. Is there some way to reduce that 90 seconds OR preferably is there a way to create a background task that will mount the share if available as a background task and not interfere with the boot process? Also is "x-systemd.automount" valid in console only mode or is only meant for when running X? I'd like that if the share hasn't been mounted already that the first attempt to read or write to it would try to auto mount it, remembering this would be in a non X environment?
K.

CwF
Global Moderator
Global Moderator
Posts: 2680
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 196 times

Re: mounting a network NFS share as background task Stretch

#2 Post by CwF »

take a look at autofs.

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: mounting a network NFS share as background task Stretch

#3 Post by debiman »

k829king wrote:In Debian Stretch that runs console only, if I add an network NFS share in fstab the boot process sits there waiting for (90seconds?) trying to mount the network share if it's unavailable before giving up and the boot process finishing and arriving at prompt. Is there some way to reduce that 90 seconds OR preferably is there a way to create a background task that will mount the share if available as a background task and not interfere with the boot process?
i'm 95% sure that a properly configured systemd service will not wait, but just let this run in the background.
Also is "x-systemd.automount" valid in console only mode or is only meant for when running X? I'd like that if the share hasn't been mounted already that the first attempt to read or write to it would try to auto mount it, remembering this would be in a non X environment?
this is unlikely to work, neither in gui (remember you still need to click the icon to mount it, before being able to access it) nor in cli.
and why would you want it this way anyhow?

User avatar
Bloom
df -h | grep > 90TiB
df -h | grep > 90TiB
Posts: 504
Joined: 2017-11-11 12:23
Been thanked: 26 times

Re: mounting a network NFS share as background task Stretch

#4 Post by Bloom »

The systemd solution given by wizard10000 is something I have used for many years when I still had NAS's (I now use LizardFS).
It works perfectly and the NFS volume would be mounted by the time the desktop was loading. Systemd tries to automount the NFS share but will continu if that doesn't succeed within the x-systemd.device-timeout given.

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: mounting a network NFS share as background task Stretch

#5 Post by debiman »

Bloom wrote:The systemd solution given by wizard10000
ah, thanks for pointing that out.
i keep forgetting this sort of magic is possible with fstab.

k829king
Posts: 133
Joined: 2018-08-26 09:47

Re: mounting a network NFS share as background task Stretch

#6 Post by k829king »

thankyou all, I think what I was missing was the "x-systemd.device-timeout=10" BUT.

I used to have lines like this
192.168.1.151:/home/SHARED /mnt/server01 nfs rsize=8192 wsize=8192 noauto,x-systemd.automount, timeo=14
192.168.1.152:/home/SHARED /mnt/server02 nfs rsize=8192 wsize=8192 noauto,x-systemd.automount, timeo=14

and now I have
192.168.1.151:/home/SHARED /mnt/server01 nfs noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14 0 0
192.168.1.152:/home/SHARED /mnt/server02 nfs noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14 0 0

This allows clients to boot up fine and quick whether the servers are online or not. BUT if the server shuts down or network cable removed then the terminal freezes the next time you try to access the share, it eventually "un-freezes" but I'm not sure how long that is other than it seems to be longer than a minute. You can start a new tty and login and all is fine as long as you do not attempt to navigate to or use the share, or again as soon as you do that session freezes for a longish period of time.

re
<<
neither in gui (remember you still need to click the icon to mount it, before being able to access it)
>> as mentioned there is no GUI.

<<
and why would you want it this way anyhow?
>>
because I have a small business system, the individual client workstations are meant to work off files held on two servers, but have the ability to work "offline" (though limited to what can do) if the servers or network goes down.
The ideal would be that the workstations normally talk to the servers but if ever they are unavailable (don't respond within say 2 seconds) then they carry on in their offline mode. And if in offline mode to periodically check if servers are back and process the backlog to the servers. Now yes the whole system could be done a completely different way, but that is a different topic. For now just looking to have network connectivity that doesn't freeze sessions for too long a period of time if the network or server becomes unavailable.

Post Reply