Hello i am trying to get my slave media center to mount a network drive at startup automatic. I have written this to my /etc/fstab/
\\192.168.1.2\root /media/data cifs username=doomstone,password=XXXX,auto,user 0 0
\\192.168.1.2\xbmc /media/xbmc cifs username=doomstone,password=XXXX,auto,user 0 0
Now when i do a "mount /media/data" it all works just fine, but it dose not mount it on statup. witch is a pain as the computer dose not have a keyboard, only a remote. So i need to ssh the computer and mount the drives each time i boot. As far as i can figure is that the computer dose not have a network connection at the mount time, and thus fails the mount of the network drives.
How can i do this so it can be mounted at startup?
Try replacing
auto
with_netdev
in the options in/etc/fstab
- this should make the mount wait until the network is up.Either write
mount /media/{data,xbmc}
to /etc/rc.local (hope it's called so in Ubuntu) or take a look at autofs.Edit: didn't see this, you have to replace your backslashes with "/" in /etc/fstab.
I've spent way too much time myself to get this sorted so I'm posting what worked for me, to have Samba 4.9.5 shares automount on boot with Debian Buster 10.5. The /etc/fstab line I initially had was something like:
With the line above (using
_netdev
) my/var/log/syslog
reported failures in name resolution, so I tried to amend the configuration using the server's IP address. This did not work either, with the errors logged being rather useless:At this point it's important to note, more so because this is the most relevant search result and it's straight up false and misleading, that the
_netdev
option is useless with Samba/CIFS mounts, it only works with NFS as specified at point 12 here.What finally did it was replacing
_netdev
withcomment=systemd.automount
, as suggested by another user here with the difference that I completely omitted_netdev
, for a final result like:This works like a charm, and in my specific scenario mounts 6 different file systems without a problem, making them available right at boot.