How to Mount Nas at Startup?

I have a NAS to which I can easily connect using the Knetattach utility via SAMBA but I would like to mount it at startup can you please tell me how to do this or point me to something I can read up on it.

Many Thanks. aamcle

Hi
Have a read here;
https://wiki.samba.org/index.php/Mounting_samba_shares_from_a_unix_client

Now are you using Wicked or NetworkManager for you connections as the network may not be up before it wants to mount the remote share…

Does your NAS support NFS?

  • You may have to use the “expert” set-up mode of your NAS.

[HR][/HR]Given the “network up” timing issue raised by malcolmlewis the combination of NFS and auto-mount may be a more viable solution.

How about using some “systemd-magic” for that?

https://www.happyassassin.net/2011/05/12/cute-systemd-trick-of-the-day-auto-mounting-remote-shares/

AK

Gnaaaaaaaah … cut that out, wrong link, old/obsolete syntax.

More recent articles

https://wiki.archlinux.org/index.php/fstab#Automount_with_systemd

(And no, this is not restricted to NFS)

http://www.dsm.fordham.edu/cgi-bin/man-cgi.pl?topic=systemd.mount&ampsect=5

AK

That method is pretty cool, it’s particularly interesting because unlike other methods, it appears to be really simple and easy to configure. The downside is that for some people though, it might still not be what they want because it can mean a significant wait to connect the first time the share is accessed. Another possible objection is that credentials are likely configured and stored in clear text, most likely in

/etc/samba/smbusers

If storing credentials in the clear is objectionable, then the comment in Malcolm’s reference is probably unavoidable… You have to mount using a PAM module.

The alternative, I wonder what it might take to hash and decypher the clear text password?
That might be something significant to look into.

Otherwise,
There are numerous ways suggested for mounting a SAMBA share on boot,
I’d probably recommend based on the method described at the following ArchWiki Samba article, with a slight modification… Since systemd has changed its mount Unit files in a major way historically, the dependent Unit files described in the example don’t exist, and any recommendation for what exists today may not be usable in the future.
https://wiki.archlinux.org/index.php/samba#As_systemd_unit

For what follows, remember that you should place all User-created or User-modified Unit files in

/etc/systemd/system

or

/etc/systemd/user

I’d recommend the following procedure to determine what should be the networking dependency!

The main idea is that a network share cannot be mounted until after networking is available, so let’s just see what kind of systemd networking Unit files are available with the following command…

systemctl -a | grep network

From the above results, pick something you believe should be suitable to ensure networking is enabled and then replace “network-online.target” with whatever you select. Today, I might select “network.target”

The result should be a network share that is mounted on boot, it may or may not make a difference in time saved depending on what else is being loaded in parallel during that time.

HTH,
TSU