2008-07-20

Fix samba share not mounting at boot

I had this annoying problem with an Ubuntu box where a Samba share that was defined in /etc/fstab would not mount at boot, and then the mount point would get corrupted the first time a program tried to write to the unmounted Samba share, and then the only way to fix it was to unmount it, delete the mount point, recreate the mount point, and then use sudo mount -a to remount it.

How I finally solved the problem was to delete the Samba share from /etc/fstab and replace it with a command line to mount it in /etc/rc.local which apparently is a script that automatically runs at the very end of the boot process.

Specifically I added the following to /etc/rc.local (all one line):
sudo mount -t smbfs -o username=defaults,password=defaults,uid=usersname,gid=groupname,fmask=770,dmask=770 "//10.10.10.110/DISK 1" /media/mountpoint