Samba shares won't automount on boot from fstab

I have FSAT setup to mount a CIFs share, but on boot up the share never gets mounted. However, if I run mount -a after boot up, it mounts everything just fine.

Here's what my fstab looks like. Ignore the commented ones... I just did a few for testing purposes right now.

//192.168.1.97/media /mnt/samba cifs credentials=/home/xbmc/.smbcredentials,rw,file_mode=0777,dir_mode=0777,sec=ntlm,auto 0 0
#//192.168.1.97/media/TV\040Shows /home/xbmc/TV\040Shows cifs credentials=/home/xbmc/.smbcredentials,rw,file_mode=0777,dir_mode=0777,sec=ntlm,auto 
//192.168.1.97/media/Movies /home/xbmc/Movies cifs credentials=/home/xbmc/.smbcredentials,rw,file_mode=0777,dir_mode=0777,sec=ntlm,auto 0 0
//192.168.1.97/media/Music /home/xbmc/Music cifs credentials=/home/xbmc/.smbcredentials,rw,file_mode=0777,dir_mode=0777,sec=ntlm,auto 0 0
#//192.168.1.97/media/3\040-\040My\040Pictures /home/xbmc/Pictures cifs credentials=/home/xbmc/.smbcredentials,rw,file_mode=0777,dir_mode=0777,sec=ntlm,auto
#//192.168.1.97/media/XBMC /home/xbmc/Admin cifs credentials=/home/xbmc/.smbcredentials,rw,file_mode=0777,dir_mode=0777,sec=ntlm,auto

Have seen a few things on the internet where it was believed its because the share isn't available yet (i.e. wifi not connected yet, etc) when it's attempting to mount.

  1. Is there anyway to confirm that's the problem,
  2. IF so, is there a solution? Is there some way to put a delay in fstab? Or how might i write a script to run mount -a a certain amount of time after boot?

Found the option _netdev from a little research, included that in fstab but still the same result.


Try to add _netdev (with the underscore) to the options. For example the first line in your fstab becomes:

//192.168.1.97/media /mnt/samba cifs credentials=/home/xbmc/.smbcredentials,rw,_netdev,file_mode=0777,dir_mode=0777,sec=ntlm,auto 0 0

According to the manpage of mount this will delay mounting until the network is up.