I have a raspberry pi humming along happily. I'd like it to mount an NFS directory and so I've set up an /etc/fstab rule: /mnt/media nfs rw,auto,hard,intr

The directory exists locally and remotely. sudo mount -a as the "pi" user mounts it with no fuss.

My problem is that the directory does not seem to mount automatically if I reboot the pi. I don't want to boot off this directory or anything, I just want it to come up when I do boot.

Any ideas what I'm doing wrong here or possibly any pointers of things I should be looking at?

  • 1
    The problem is almost certainly due to the fact that the network interface is not initialised at the time fstab is executed. Many other seem to have similar problems, particularly with WiFi network. I suggest you put in a script that runs at log on time.
    – Milliways
    Commented Mar 3, 2014 at 0:46
  • In my case, the network is ethernet, not WiFi. A login script won't work in my use case as I want a script at startup to be able to access the mount rather than a user logging in. I was unsure at what point the mount would be guaranteed available otherwise the startup script could handle this. I was worried that even if the startup script seemed to work, it may depend on a race condition that wouldn't always work.
    – Gregable
    Commented Mar 4, 2014 at 4:11

6 Answers 6


A quick and dirt hack would be to edit /etc/rc.local and add "mount /mnt/media". This will automatically be carried out on boot. The correct way, I think, would be to add the nfs-common init script to the default runlevel. This can be done by using the update-rc.d command.

sudo update-rc.d nfs-common enable
  • I tried your 'correct way' and it appears to do the trick.
    – Gregable
    Commented Mar 4, 2014 at 4:18
  • running the command above return error: Failed to enable unit: Unit file /lib/systemd/system/nfs-common.service is masked.
    – swift2geek
    Commented Apr 13, 2020 at 13:59
  • should I also remove mount from /etc/fstab ? where I should add that mount command?
    – swift2geek
    Commented Apr 13, 2020 at 14:00
  • In both cases the line for the mount should remain in /etc/fstab.
    – Fred
    Commented Jul 20, 2020 at 0:31

I had the same problem as you. In my case, running

sudo raspi-config

and selecting Wait for network at boot/Yes did the trick.

  • After doing what fred suggested and not having any joy I tried this and it worked! Thanks.
    – aydjay
    Commented Feb 26, 2019 at 15:03

Another option (requiring a little more work) that you may want to look into is AutoFS. AutoFS will allow you to configure mount points such that they are mounted automatically when the mount point is accessed and unmounted after some time of inactivity. When using this with NFS it can help you reduce your network traffic by only keeping that connection open when it's needed.




I had a similar problem. Try the following solution, the last step might be what you want,

Get the uuid of the external hard drive with following command

sudo blkid

Add the entry into fstab so that when you restart the raspberry device it is auto mounted every time

sudo nano /etc/fstab

UUID=0A423D084xxxxxx /mnt/data ntfs defaults,noatime,auto 0 0

Some explanation for above command - I mounted it to /mnt/data directory. ( You need to create it first if doesn't exist with sudo mkdir /mnt/data ) Mine was a NTFS format. You might try only the defaults option. I added noatime and auto to experiment a few things. You can check more details about it on internet.

Some Raspberry device ( including mine ) needs one more addition ( optional, try only if above doesn't work ), after above command, add a 5 seconds delay to loading the device as sometimes the Raspberry OS loads faster than external drive and external hard drive loads a little slower and need more time to start, in this case the external drive isn't auto mounted and it is skipped with an error at the start. Add the following property/value to the end of your cmdline.txt inside /boot folder

sudo nano /boot/cmdline.txt



Hope it helps!

  • blkid is not applicable to mounting a remote filesystem via nfs.
    – Ghanima
    Commented Oct 8, 2018 at 22:38

I found an answer here:


From the user "mandelsoft"

Create this file: /etc/systemd/system/nfs-kernel-server.service.d/10-dep.conf

And within it:


I'm running on MATE for the pi. So other OSes may give you different results, but on my system at least, this fixes the problem reliably.


I hadn't seen all the updated answers on this thread, but managed to find a similar way to mount an NFS drive on my Raspberry Pi 4.

The main prob seems to be that the LAN/network interface is very late coming up / going active.

I added a @reboot on the 1st line of my crontab.

Then ran a small bash script ---


pause 30
sudo mount -a

I'm sure this could be done better, poss the exact NFS mount command, so this bash file is merely running the mount command I previously had to run manually.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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