Permanently mount network NAS

I have been mounting network NAS permanently in the Ubuntu Linux as fooloows.

sudo nano /etc/fstab
//winServerName/shareName /media/mountName cifs credentials=/home/userId/.smbcredentials,uid=1000,gid=1000,vers=3.0,nounix 0 0

How it can be done in Rocky Linux…

You can do it the same way. You can install nano via dnf if you wish or you can use vi to edit /etc/fstab.

1 Like

While I don’t have CIFS mounts, I’d consider additional options:

noauto,nofail,x-systemd.automount,x-systemd.idle-timeout=300

The first two essentially say that the mount does not have to happen, and particularly succeed already at boot.
The other two generate systemd mount unit that will automount the volume when you actually access it and also umount it when you don’t need it.

2 Likes

Is it code for the /etc/fstab ? your full description is well appreciated.

They are just additional mount options, so your fstab line could look like:

//winServerName/shareName /media/mountName cifs credentials=/home/userId/.smbcredentials,uid=1000,gid=1000,vers=3.0,nounix,noauto,nofail,x-systemd.automount,x-systemd.idle-timeout=300 0 0
1 Like

Doesn’t your NAS support NFS? If you are using Linux I’d set that up on the NAS, then connect to that rather than using CIFS. It is simpler & faster.