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:

\\\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.


  • 2
    If the server is running Ubuntu, it is likely you need a / rather then a \ - "// " See wiki.ubuntu.com/MountWindowsSharesPermanently
    – Panther
    Jan 3, 2014 at 21:01
  • @bodhi.zazen It may have had the / when I entered it, but it now reads out with the \
    – douggro
    Jan 3, 2014 at 22:42
  • Check the syntax ( / vs \ ) in fstab
    – Panther
    Jan 3, 2014 at 22:43
  • @bodhi.zazen I'm pretty sure that the wiki article is what I followed when setting it up. I'll check syntax later when I get time to sit with my server.
    – douggro
    Jan 4, 2014 at 1:00
  • 1
    @bodhi.zazen Please convert your comment to an answer - changing the \ to / solved it.
    – douggro
    Jan 4, 2014 at 9:12

6 Answers 6


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


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
  • 3
    thank you, this worked for me in 18.04 LTS
    – Chief
    Jul 19, 2018 at 23:44
  • 2
    _netdev wasn't working on 18.04, this worked perfectly :) May 30, 2019 at 12:58
  • 1
    Works in Raspbian 10
    – Michael
    Jan 20, 2020 at 17:04
  • Thank you, this is the correct answer for Ubuntu 20.04 as well
    – lamka02sk
    Oct 18, 2020 at 0:11
  • Excellent! This is the only thing that worked my Mybooklive to mount on boot. Also had to add vers=1.0 as an option.
    – cdsaenz
    Feb 19, 2022 at 16:05

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

//  /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.

  • Can you add context to where that would be placed in the fstab line? With that, and a period where I can reboot the server when it's not being used, I will give it a try. Thanks for answering.
    – douggro
    Jan 3, 2014 at 20:33
  • 1
    This worked for me in Ubuntu 12.04 but not in Ubuntu 16.04. Has this changed in the latest version?
    – Katu
    Apr 25, 2016 at 14:46
  • 2
    Note: I think _netdev actually works in 16.04, however credentials=/home/user/.smbcreds does no longer works. At least for me when I use user=, pass=, _netdev it works, when I use credentials=,_netdev it does not. Both work via sudo mount-a from the command line after booting.
    – jb510
    Jun 5, 2016 at 2:59
  • 1
    I actually think this might have more to do with the permission changes that were made to the media folder. At some point, Ubuntu started mounting things to /media/username/folder name rather than /media/folder name. If don't mount to the "username" location then you have to have sudo level permissions for access. If you change your path to use the /media/username path I think it should still work. Aug 1, 2016 at 18:01
  • 3
    _netdev - Only valid with fstype nfs Aug 28, 2017 at 20:20

I am using the Raspbian-Stretch build dated 2017-09-07 and experienced the same issue. However, I was able to overcome this by going into raspi-config and under the Boot Options menu, I enabled the "Wait for network at boot" option.

  • 3
    This is actually VERY helpful, i had problems that even if boot said everything OK it did just not mounted it or display folders May 7, 2018 at 19:29
  • Thanks! That was it. This must be #1 reason for fstab entries not loading or raspberries as such option is turned off by default. Cheers.
    – drakorg
    Nov 1, 2020 at 19:54
  • 1
    This does a great job of filling in for the "_netdev" argument, which ONLY works for NFS shares.
    – Frankie0p
    Oct 17, 2022 at 10:35

It is a syntax error, I think you need a "/" rather then a "\", like this

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

See : https://wiki.ubuntu.com/MountWindowsSharesPermanently for additional information.

  • Using forward slashes (/) did NOT fix it for me.
  • Also, adding the option _netdev to my /etc/fstab entry did NOT fix it for me.

What I have done to fix this problem (on my Pi3) is modify /etc/rc.local to sleep 20 seconds (by calling sleep 20) and then call mount -a. This way, even though the network is NOT connected yet when the system first reads the fstab file, so the mount fails then, I force the system to wait 20 seconds here (giving the network time to connect) then I force it to call mount -a again to mount all drives in the fstab file.

Here is what my /etc/rc.local file now looks like:

#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.

# Print the IP address
# GS notes: a *minimum* of `sleep 10` is required for the mount below to
# work on the Pi 3; it failed with `sleep 5`, but worked with `sleep 10`,
# `sleep 15`, and `sleep 30`
sleep 20
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
  mount -a #GS: mount all drives in /etc/fstab

exit 0

Done! It now works perfectly for me!


  1. [my answer] https://raspberrypi.stackexchange.com/a/63690/49091
  2. https://www.raspberrypi.org/documentation/linux/usage/rc-local.md
  3. http://elinux.org/RPi_Email_IP_On_Boot_Debian - they have a similar rc.local file with a comment in it that says:
    # Print the IP address if it doesn't work ad sleep 30 before all your code

English grammar follow-up question I had regarding an edit to my answer:

  1. https://english.stackexchange.com/questions/568348/need-help-identifying-if-this-is-1-grammatically-correct-and-2-an-infinitive
  • Are you connecting via wifi?
    – cbcoutinho
    Nov 17, 2017 at 22:27
  • Yes, I'm using WiFi instead of ethernet. Nov 21, 2017 at 13:41
  • That's indeed very strange, but probably not related to my issue. I have three network drives I'm trying to connect through an ethernet cable - no wifi. One of the drives' names has a special character in it, and that causes it to not be connected after a fresh boot. Executing sudo mount -a solves the issue, but I'm curious why it doesn't work while booting up. I'll try your solution and see if that helps.
    – cbcoutinho
    Nov 21, 2017 at 13:58
  • 1
    You wrote "What I have done to fix this problem (on my Pi3) is modify /etc/rc.local to sleep". The use of 'modify' here is good correct English. To use 'modifying' would be wrong. Pseudo-cleft sentences (also called wh-clefts) are similar in function to cleft sentences, but they are formed with the pronoun what (= the thing(s) that/which). The emphasis in a pseudo-cleft sentence is on the phrase after the what-clause + be: In the past simple and present perfect, we can use the following pattern What I have done is (to) write a letter to the editor. Jun 2, 2021 at 19:41

The failsafe method, always remember these 3 altogether:

  • noauto
  • x-systemd.automount
  • _netdev

Always works.

Method from How to auto mount using sshfs?, which I'm quoting below:

I am adding an fstab method, since no one talks about it in this page. If you don't want hacks and use the builtin advanced mounting features, you need to use /etc/fstab and never look back.

user@host:/remote/folder /mount/point  fuse.sshfs noauto,x-systemd.automount,_netdev,IdentityFile=/home/name/.ssh/id_rsa, allow_other,reconnect 0 0
  • noauto will stop the no-brainer actions like forcibly mounting whatsoever at booting regardless if the network is up or not.
  • x-systemd.automount is the smart daemon that knows when to mount.
  • The _netdev tag will also identify that it uses network devices, thus it will wait until the network is up.
  • 1
    it has not work in my 20.04LTS machine, there has to be some more secret ingredients. Jan 16, 2021 at 22:07
  • Worked great for me on Debian 11 (Bullseye) for a CIFS mount. Thanks!
    – HerbCSO
    Feb 9, 2023 at 5:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .