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:


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.


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.

On my side, NFS is slower than cifs actually. I have to qnap NAS and they are faster when mounted as cifs rather than nfs. I am on a 10gig network and the speed with cifs is around 700mb when i got around 350mb with nfs.

The OP’s mount line looked fine to me and the fact that it appears their NAS supports version 3.0 leads me to believe that the issue of connecting may be firewall related. Without error output information it is difficult to diagnose cifs issues. I don’t know the right journalctl options to get the cifs output as I enable rsyslog on my machines so that I have separate samba logs that I can browse for errors.