I have been working at solving this for a bit. I finally have a couple fstab lines that will mount with
sudo mount -a
I was getting errors when I would reboot. It could not mount these locations. I finally came to the conclusion it was because the network had not “come up” yet.
Searching the forums, I found a few instances of the same problem where others were told to add “_netdev” to the fstab line. I never clearly found an example of the correct syntax.
Once I added it, I am now able to boot without the boot error related to mounting the location, but now it never mounts the location. If I go to the CLI and run sudo mount -a, they mount fine.
You could try adding x-systemd.automount to the fstab parameters, and hopefully it will automatically mount the location when you try to access it. This won’t necessarily “mount it at boot time”, but it should likely allow you to mount it on demand simply by browsing to the location, or accessing it via another program.
You can also add nofail for an unimpeded boot process.
When you mount network shares in fstab - the mount is depending on your network which must be up and connected for the mount to succeed.
The easiest method is to use systemd units.
And for your own sanitys sake - don’t use /mnt - it’s designated temporary mounts - you are likely to get permission errors or worse when a script you use rely on temporary mount.
Create the script from the topic above and edit the variables section then run it.
# MODIFY THESE VARIABLES
# your samba server's hostname or IP address
HOST="my-server"
# the share name on the server
SHARENAME="my-share"
# symlink name
LINKNAME="$SHARENAME"
# symlink is placed in this folder
SYMLINKS="$HOME/SMBLinks"
# credentials
USERNAME=
WORKGROUP=
PASSWD=
# /END MODIFY
When you get more confident with Linux - you can create a user service for it. Also explained in the topic linked.
Mounting using fstab can be frustrating and over the years it has given me headache more than once.
Especially when you mount network shares using fstab. With systemd you never know in which order anything becomes available because everything initializes in parallel using threading.
This causes shares to become arbitrarily unavailable more often than most will admit.
Over the years, I found the only reliable method on systemd is to use mount units.
Once setup they just work - no mounting on boot - but mounting on access - umount when idle for a configurable time.
OK, I finally got it working and coming up as expected at boot using systemd mount units. That was an interesting learning curve, but I think I must be missing something.
The new problem (or irritation), is the system now takes 90 seconds to shut down. I get a "system is going to shut down NOW??? message, and then it takes 90 seconds. When I disable the systemd mount, the system shuts down normal (like three seconds with no message). I then enable and start the mount. The shutdown now takes 90 seconds. I don’t know how to troubleshoot this (noob again)…
My mount below (found a script that helped a little). Is it something in there? Thanks for the help.
1 - Create Mount Unit (must have prior to Automount … I learned) and save in /etc/systemd/system
- Filename MUST BE named after mount path. eg Mount Path = /home/jim/1_TrueNAS/Remote -----> File Name = home-jim-1_TrueNAS-Remote.mount
My Mount Unit
2 - Create Automount in same folder using same naming convention other than automount at the end instead of mount → home-jim-1_TrueNAS-Remote.automount