I've got Raspbian running on RaspberryPi 2. I've a WIFI dongle, configured network/interfaces to automatically connect to my home network... all works great.

I've a windows share on my LAN that I want to mount on raspbian. I edited /etc/fstab file. My added line works fine when I use Ethernet cable, it automatically mounts the share on boot. However, when on WiFi it doesn't. I'm guessing it runs fstab too early before the WiFi connects.... also if I run sudo mount -a, it reads the rule from fstab and applies it just fine...

My question is, how can I get the system to automount AFTER there is an available connection? or after it acquires an IP maybe?

I looked at udev rules but I'm not sure if that's the way to go...

2 Answers 2


You might want to take a look into "network interface configuration for ifup and ifdown" with

man interfaces

The configuration file allows several "command" options. In your case you might want to take a look into the option

post-up command

which is run after the interface is brought up.


While the NFS-specific mount binary supports a bg option, the CIFS mount does not.

Options I can think of:

  • Create a script that attempts to perform the mount, but sleeps and loops if unsuccessful. Exit if mount successful. Run as a startup script.
  • Install and use the automounter, autofs.

You must log in to answer this question.

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