CIFS mount through fstab not mounting at boot

I have a CIFS share on my NAS that I want to have mounted at boot - it's used by my MythTV server as the main media store. I added an entry into fstab to have it mount but it doesn't. It appears that, after looking through my system logs, fstab is being read before my network interfaces are coming online. Is there any edit I can make to the fstab entry that would alter this?

The fstab entry for mounting the share is:

\\192.168.0.26\mythtv\media  /media/mybooklive  cifs  username=user,password=pass,umask=002,uid=136,gid=144,iocharset=utf8   0       0

It mounts fine after boot when I issue sudo mount -a and there are no other issues with it.

Thanks!


Solution 1:

Have you tried adding the option _netdev to your fstab entry? You would add it with the other options in your string like so

//192.168.0.26/mythtv/media  /media/mybooklive  cifs  username=user,password=pass,_netdev,umask=002,uid=136,gid=144,iocharset=utf8   0       0

_netdev is supposed to delay the mount until after the network connects.

Solution 2:

If _netdev doesn't work, try this option instead:

x-systemd.automount

It works by mounting the drive at first access.

To test the automount, unmount your share if it's currently mounted:

sudo umount /media/mybooklive

And then restart the remote-fs systemd unit:

sudo systemctl daemon-reload
sudo systemctl restart remote-fs.target