View previous topic :: View next topic |
Author |
Message |
mcnutty Tux's lil' helper
Joined: 29 Dec 2009 Posts: 120
|
Posted: Thu Apr 20, 2023 9:50 pm Post subject: Mounting network drives during boot is very slow |
|
|
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 |
|
|
pingtoo l33t
Joined: 10 Sep 2021 Posts: 887 Location: Richmond Hill, Canada
|
Posted: Thu Apr 20, 2023 10:31 pm Post subject: |
|
|
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 |
|
|
mcnutty Tux's lil' helper
Joined: 29 Dec 2009 Posts: 120
|
Posted: Thu Apr 20, 2023 10:46 pm Post subject: |
|
|
Thanks for the suggestion.
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 |
|
|
mcnutty Tux's lil' helper
Joined: 29 Dec 2009 Posts: 120
|
Posted: Sun Apr 23, 2023 2:58 pm Post subject: |
|
|
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 |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21489
|
Posted: Sun Apr 23, 2023 3:31 pm Post subject: |
|
|
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 |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54096 Location: 56N 3W
|
Posted: Sun Apr 23, 2023 5:11 pm Post subject: |
|
|
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 |
|
|
mcnutty Tux's lil' helper
Joined: 29 Dec 2009 Posts: 120
|
Posted: Sun Apr 23, 2023 7:16 pm Post subject: |
|
|
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 |
|
|
mcnutty Tux's lil' helper
Joined: 29 Dec 2009 Posts: 120
|
Posted: Sun Apr 23, 2023 8:12 pm Post subject: |
|
|
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:
|
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54096 Location: 56N 3W
|
Posted: Sun Apr 23, 2023 8:18 pm Post subject: |
|
|
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 |
|
|
mcnutty Tux's lil' helper
Joined: 29 Dec 2009 Posts: 120
|
Posted: Sun Apr 23, 2023 8:37 pm Post subject: |
|
|
NeddySeagoon wrote: |
Edit /etc/rc.conf to enable loging.
Pastebin dmesg and the startup log from openrc. |
dmesg
rc.log |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54096 Location: 56N 3W
|
Posted: Mon Apr 24, 2023 8:29 am Post subject: |
|
|
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 |
|
|
mcnutty Tux's lil' helper
Joined: 29 Dec 2009 Posts: 120
|
Posted: Mon Apr 24, 2023 12:59 pm Post subject: |
|
|
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 |
|
|
|