1

When booting my debian unstable linux box the process is delayed when it attempts to mount NFS partitions from another machine which is not switched on. The message displayed during boot is:

[***   ] A start job is running for /media/photos [1 of 4] [35s/1m 45s]

The stars on the left animate, and it cycles through the four mounts points I have defined in /etc/fstab:

mnemosyne:/mnt/volume1/videos       /media/videos       nfs defaults 0 0
mnemosyne:/mnt/volume1/books        /media/books        nfs defaults 0 0
mnemosyne:/mnt/volume1/photos       /media/photos       nfs defaults 0 0
mnemosyne:/mnt/volume1/downloads    /media/downloads    nfs defaults 0 0

For a long time this setup has worked without the delay. If the machine with the mount points wasn't on, it would timeout immediately and continue a normal system boot.

1
  • 1
    You should not depend upon a server that is not reliable. You could add the noauto option to /etc/fstab or you could consider using automount instead of fstab. Jun 21, 2015 at 16:51

1 Answer 1

3

I found this debian bug report about a related issue that proposes the same solution as @Henrik:

Unfortunately, we can't easily make NetworkManager.service pull in network.target, because with our current support for rcS type services this would create a dependency loop.

I would suggest, that if you are using NetworkManager, you switch your NFS mount to use comment=systemd.automount to delay the actual mount request until it is accessed.

I removed the mount points from /etc/fstab and configured automount as follows.

/etc/auto.master

/mnt/myserver /etc/auto.myserver --timeout=180

/etc/auto.myserver

home/jon    -fstype=nfs,rw,suid,soft,intr,nouser,relatime   192.168.2.45:/mnt/volume1/home/jon
videos      -fstype=nfs,rw,suid,soft,intr,nouser,relatime   192.168.2.45:/mnt/volume1/videos
books       -fstype=nfs,rw,suid,soft,intr,nouser,relatime   192.168.2.45:/mnt/volume1/books
photos      -fstype=nfs,rw,suid,soft,intr,nouser,relatime   192.168.2.45:/mnt/volume1/photos
downloads   -fstype=nfs,rw,suid,soft,intr,nouser,relatime   192.168.2.45:/mnt/volume1/downloads
music       -fstype=nfs,rw,suid,soft,intr,nouser,relatime   192.168.2.45:/mnt/volume1/music
games       -fstype=nfs,rw,suid,soft,intr,nouser,relatime   192.168.2.45:/mnt/volume1/games

```

The NFS mounts are now mounted when they are accessed. This also means that, in contrast to using /etc/fstab, the local folders (e.g. /mnt/myserver/music) don't exist until they're accessed.

If anyone is looking at the /home/jon mount and wondering how I survive without a home folder at boot, it's worth mentioning that that isn't actually my home folder.

1
  • If this isn't working for anyone, they need to make sure that the autofs package is installed. Nov 2, 2022 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.