Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Mounting network drives during boot is very slow
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
mcnutty
Tux's lil' helper
Tux's lil' helper


Joined: 29 Dec 2009
Posts: 120

PostPosted: Thu Apr 20, 2023 9:50 pm    Post subject: Mounting network drives during boot is very slow Reply with quote

I have a number of network drives (a mix of SMB/CIFS and NFS shares) that I mount during boot using /etc/fstab and the _netdev option. Everything is functional, but it adds a little over 2 minutes to the boot time where it just hangs on the message "mounting network filesystems".

I noticed the following in /var/log/messages, which appears to show the 2 minute gap (although I don't see the NFS shares being mounted even though they are):

Code:
8136 Apr 20 14:42:14 myhost kernel: [   11.600737] IPv6: ADDRCONF(NETDEV_CHANGE): enp5s0: link becomes ready
8137 Apr 20 14:44:31 myhost kernel: [  148.369754] CIFS: Attempting to mount \\truenas\Share1
8138 Apr 20 14:44:31 myhost kernel: [  148.450004] CIFS: Attempting to mount \\truenas\Share2
8139 Apr 20 14:44:31 myhost kernel: [  148.453706] CIFS: Attempting to mount \\truenas\Share3
8140 Apr 20 14:44:31 myhost kernel: [  148.456516] CIFS: Attempting to mount \\truenas\Share4
8141 Apr 20 14:44:31 myhost kernel: [  148.461374] CIFS: Attempting to mount \\truenas\Share5
8142 Apr 20 14:44:31 myhost kernel: [  148.465570] CIFS: Attempting to mount \\truenas\Share6


My understanding is that there is some dependency that requires the network to be up before the drives can mount, so there will always be some additional delay in booting, but 2+ minutes seems excessive and as far as I can tell the network is up, but the system still just hangs waiting to mount.

Is there anything I can do to speed up the mounting process?
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


Joined: 10 Sep 2021
Posts: 887
Location: Richmond Hill, Canada

PostPosted: Thu Apr 20, 2023 10:31 pm    Post subject: Reply with quote

Could it possible be waiting for DNS?

What if you test use IP address instead of name. see if that make it happen faster.
Back to top
View user's profile Send private message
mcnutty
Tux's lil' helper
Tux's lil' helper


Joined: 29 Dec 2009
Posts: 120

PostPosted: Thu Apr 20, 2023 10:46 pm    Post subject: Reply with quote

Thanks for the suggestion. :D

I'm just using a hosts file, but swapped the name with the ip address just in case, but unfortunately it made no difference.
Back to top
View user's profile Send private message
mcnutty
Tux's lil' helper
Tux's lil' helper


Joined: 29 Dec 2009
Posts: 120

PostPosted: Sun Apr 23, 2023 2:58 pm    Post subject: Reply with quote

After some testing it appears that the problem is the NFS shares. If I remove them from boot then the CIFS shares mount almost immediately. Unfortunately, nothing shows up in /var/log/messages for the NFS shares (and I'm not sure where else any info might be logged), so it's hard to know what's going on.

The shares are served from a truenas box on the local network, but I don't see anything on the server logs either.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21489

PostPosted: Sun Apr 23, 2023 3:31 pm    Post subject: Reply with quote

If you instead mount NFS shares served from a modern Linux system, do those complete quickly? This will help us determine whether the problem is your NFS client or the NFS server.

Are NFS mounts from the truenas always slow, or only slow when mounted at boot?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54096
Location: 56N 3W

PostPosted: Sun Apr 23, 2023 5:11 pm    Post subject: Reply with quote

mcnutty,

does _netdev imply bg too?

With bg, the mounts won't be any faster but the boot process will not wait for them.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
mcnutty
Tux's lil' helper
Tux's lil' helper


Joined: 29 Dec 2009
Posts: 120

PostPosted: Sun Apr 23, 2023 7:16 pm    Post subject: Reply with quote

Hu wrote:
If you instead mount NFS shares served from a modern Linux system, do those complete quickly? This will help us determine whether the problem is your NFS client or the NFS server.

I'm not sure. I don't have a separate machine to test on at the moment. Would it still help to debug setting up a share even if it's the same physical machine?

Hu wrote:
Are NFS mounts from the truenas always slow, or only slow when mounted at boot?

It is only slow at boot. If I prevent them from mounting at boot and then mount them manually, either individually or via mount -a, they attach almost instantaneously.

NeddySeagoon wrote:
does _netdev imply bg too?

With bg, the mounts won't be any faster but the boot process will not wait for them.


I'm not sure, but I don't think so. I can try to explicitly add bg to the options to see what happens.[/quote]
Back to top
View user's profile Send private message
mcnutty
Tux's lil' helper
Tux's lil' helper


Joined: 29 Dec 2009
Posts: 120

PostPosted: Sun Apr 23, 2023 8:12 pm    Post subject: Reply with quote

NeddySeagoon wrote:
does _netdev imply bg too?

With bg, the mounts won't be any faster but the boot process will not wait for them.


I just tried mounting without the _netdev option, but with the bg option. Strangely, it made no difference.

In case it helps here is a line in my fstab:
Code:
192.168.1.3:/mnt/nas/Share    /var/cache/distfiles    nfs    defaults,noatime,rsize=1049000,wsize=1049000,nofail,bg        0 0


My /etc/conf.d/netmount only has a single uncommented line:
Code:
rc_need="dhcpcd"
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54096
Location: 56N 3W

PostPosted: Sun Apr 23, 2023 8:18 pm    Post subject: Reply with quote

mcnutty,

Edit /etc/rc.conf to enable loging.
Pastebin dmesg and the startup log from openrc.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
mcnutty
Tux's lil' helper
Tux's lil' helper


Joined: 29 Dec 2009
Posts: 120

PostPosted: Sun Apr 23, 2023 8:37 pm    Post subject: Reply with quote

NeddySeagoon wrote:

Edit /etc/rc.conf to enable loging.
Pastebin dmesg and the startup log from openrc.

dmesg
rc.log
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54096
Location: 56N 3W

PostPosted: Mon Apr 24, 2023 8:29 am    Post subject: Reply with quote

mcnutty,

From the kernel starting to CIFS attempting to mount is 149 sec.
Code:
[   33.048539] logitech-hidpp-device 0003:046D:405E.0006: HID++ 4.5 device connected.
[  148.786425] CIFS: Attempting to mount \\192.168.1.3\AnyDvd


Code:
 * Executing: /lib/rc/sh/openrc-run.sh /lib/rc/sh/openrc-run.sh /etc/init.d/local start
 * Starting local ...
 *   Executing "/etc/local.d/netmount.start" ...
 [ ok ]


It looks like netmount is started (again) by the local service. That's the very last thing to start.

Its also started
Code:
 * Executing: /lib/rc/sh/openrc-run.sh /lib/rc/sh/openrc-run.sh /etc/init.d/netmount start
 * Mounting network filesystems ...
 [ ok ]
which is before networking is started, which is too early.

It looks like adding it to local.d was a hack to work around the real problem.

net.lo should be the first to start,
Code:
 * Executing: /lib/rc/sh/openrc-run.sh /lib/rc/sh/openrc-run.sh /etc/init.d/net.lo start
 * Bringing up interface lo
but there is no sign of your real network starting. How do you do that?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
mcnutty
Tux's lil' helper
Tux's lil' helper


Joined: 29 Dec 2009
Posts: 120

PostPosted: Mon Apr 24, 2023 12:59 pm    Post subject: Reply with quote

NeddySeagoon wrote:
mcnutty,

From the kernel starting to CIFS attempting to mount is 149 sec.
Code:
[   33.048539] logitech-hidpp-device 0003:046D:405E.0006: HID++ 4.5 device connected.
[  148.786425] CIFS: Attempting to mount \\192.168.1.3\AnyDvd



That's why I initially thought it was the CIFS shares causing the problem, but removing them from the fstab didn't solve the problem, but removing the NFS shares did.

NeddySeagoon wrote:

Code:
 * Executing: /lib/rc/sh/openrc-run.sh /lib/rc/sh/openrc-run.sh /etc/init.d/local start
 * Starting local ...
 *   Executing "/etc/local.d/netmount.start" ...
 [ ok ]


It looks like netmount is started (again) by the local service. That's the very last thing to start.

Its also started
Code:
 * Executing: /lib/rc/sh/openrc-run.sh /lib/rc/sh/openrc-run.sh /etc/init.d/netmount start
 * Mounting network filesystems ...
 [ ok ]
which is before networking is started, which is too early.

It looks like adding it to local.d was a hack to work around the real problem.

net.lo should be the first to start,
Code:
 * Executing: /lib/rc/sh/openrc-run.sh /lib/rc/sh/openrc-run.sh /etc/init.d/net.lo start
 * Bringing up interface lo
but there is no sign of your real network starting. How do you do that?


I'm starting the network via dhcp:
Code:
 * Executing: /lib/rc/sh/openrc-run.sh /lib/rc/sh/openrc-run.sh /etc/init.d/dhcpcd start
 * Starting DHCP Client Daemon ...
 * start-stop-daemon: fopen `/var/run/dhcpcd/pid': No such file or directory
 * Detaching to start `/sbin/dhcpcd' ...
 [ ok ]


In the past I remember having to setup the networking similar to what is described in the netifrc section of the handbook (e.g., creating symbolic links to the network interfaces), but I think this time just using dhcpcd without any further configuration seemed to work.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum