I have a few remote SMB shares on my NAS which I always wanted to have automatically mounted during the boot process. Back in the PCBSD 9(?) times that worked really well with /etc/fstab. But then some things changed and it did not work anymore. I do not even remember the details. Wifi was not up when the system should have mounted the shares (even with the -late option). And when shutting down the system it took forever when I forgot to manually unmount them.
Today I thought with autofs it could be worth to give it another shot and I read the auto_master man pages. It turns out it is incredibly easy now. There is more than one way but I had an old fstab file at hand and chose the following option:
In /etc/auto_master uncomment the line :
In /etc/fstab add your SMB shares, e.g.:
//USERNAME@NAS/share /mnt/NAS/share smbfs rw,late,noauto,-N,-Ixxx.xxx.xxx.xxx,-u=USER 0 0
The noauto option is important, of course. And with the -N option you need to populate the file /etc/nsmb.conf accordingly. I also created the mountpoint /mnt/NAS/share beforehand.
Works like a charm!