Re: how to force mounting an entry in fstab on boot?
On Mon 23 Oct 2023 at 17:28:54 (+0200), hw wrote:
> On Mon, 2023-10-23 at 10:30 -0400, Greg Wooledge wrote:
> > On Mon, Oct 23, 2023 at 04:17:11PM +0200, hw wrote:
> > > I have an entry in the fstab to mount an NFS share via IPv6. For
> > > unknown reasons, the entry is being ignored on boot, so after booting,
> > > I have to log in as root and do a 'mount -a' which mounts the share
> > > without problems.
> >
> > Do your IPv4 NFS mounts have the same behavior?
>
> No, I can mount the same share with the host name or the IPv4 address
> of the same server, and it works as it should. The IPv6 connection is
> set to be required at boot.
>
> > > [fd53::11]:/srv/example /home/example/foo nfs _netdev 0 0
> >
> > On my systems, the options field contains "defaults,_netdev" and possibly
> > a few other things. I don't know whether that matters.
>
> I'll try --- I think it uses defaults anywhen when no defaults are
> specified. What else would it use other than defaults ...
>
> > If you add an entry to /etc/hosts for this NFS server, and mount the
> > share by hostname, does that change anything?
>
> I have a DNS server (on the same machine that serves the share) which
> works fine. Making an entry in /etc/hosts is something I want to
> avoid. If the addresses of the server ever change, I wont remember
> that entry and will have to spend ever so much time to figure out
> what's wrong ...
>
> > > I have another case in which machines need to be connected to a
> > > particular VLAN to mount home directories. In case they are not
> > > connected to that VLAN, I don't want the boot process to proceed at
> > > all because the home directories won't be available.
> >
> > Hmm... can you add the "fail" option after _netdev? I've never tried.
>
> Hm, in man mount, there's only 'nofail' for when the mount is allowed
> to fail. That also means that mounts must not fail and the failure
> must not be ignored. Same goes man fstab. I doubt there's a 'fail'
> option. Who would want a mount to fail?
>
> > > So how do I force it that the entries in fstab are not being silently
> > > ignored? I want these shares either mounted, like through like 3
> > > retries, or booting to stop when they can't be mounted.
> >
> > I do not know how to allow a specific number of retries. Not without
> > writing your own hacked-up shell scripts, at least.
>
> The retries aren't exactly necessary; I merely thought it can't hurt
> to retry, and systemd should do that anyway when there's a failure the
> first time.
You've read man mount, but have you read man systemd.mount?
Specifically the second paragraph of FSTAB.
Cheers,
David.
Reply to: