Mount fstab volumes on startup

5,553

I tried these options to solve the same problem on Ubuntu 18.04LTS:

  • Insert "comment=systemd.automount" into the relevant mount statements in /etc/fstab. PROBLEM: This option produced multiple mounts of the same network shares when I tried to use it for two different network shares.
  • Insert "mount -a" into /etc/rc.local. PROBLEM:This seemed to have no effect! As superuser, create a script with the following text in directory /etc/network/if-up.d/ and give it execute permissions:
  • As superuser, create a script with the following text in directory /etc/network/if-up.d/ and give it execute permissions:

#!/bin/sh mount -a

PROBLEM SOLVED! The last solution works well. Scripts located in /etc/network/if-up.d/ run after a network connection is established. This script then mounts the network shares (and any other pending mounts) already stipulated in /etc/fstab.

Share:
5,553

Related videos on Youtube

Bruno René Santos
Author by

Bruno René Santos

Updated on September 18, 2022

Comments

  • Bruno René Santos
    Bruno René Santos over 1 year

    In Ubuntu 18.04 I lost the ability to automatically mount network shares from fstab on startup. Every time I start my computer I have to manually mount all shares with sudo mount -a... I have already tried to include a @reboot mount -a on crontab but it does not work... It happened to me with Ubuntu MATE 18.04 and Kubuntu 18.04 so it seems to be a Core Ubuntu problem and not a desktop issue...

    Cheers Bruno

    • Organic Marble
      Organic Marble over 5 years
      If you haven't resolved this, please edit your question and add the complete listing of your fstab file. This problem is almost certainly fixable.
  • Bruno René Santos
    Bruno René Santos almost 6 years
    Thanks a lot for the answer but this does not seem a good solution for me. Sometimes I just turn on the computer and do not login. On Ubuntu 17.10 this was done automatically on the background, so something broke on 18.04. I wanted to get back the behaviour ubuntu had previously. One thing would help would be someone pointing me out where can I report this bug so that it gets fixed.
  • Organic Marble
    Organic Marble over 5 years
    Best to mount by UUID and then you don't care what the device names are.