scripts:files:mount_smb_nfs_nas_share_in_fstab

Mount SMB and NFS shares for a NAS with the fstab

Note: decide if you want a soft or hard mount. I have not included it in the below version, but it makes a big difference.

I use soft mounts for NAS mounts to avoid the case where my server is offline or I change networks just hanging applications indefinitely. ServerFault thread

192.168.x.y:sharename    /media/yourfolder    nfs    defaults,nofail    0 0

explanation: ip address, mount point, filesystem, options, order. nofail makes it so the boot can continue even if the mounting fails. This is useful on a laptop and you may not always be connected to your network.

//192.168.x.y/sharename    /media/yourfolder    cifs    auto,nofail,username=user,password=pass,domain=yourdomain,uid=1000,gid=1000    0 0

explanation: smb can have authentication using username and password and domain, they are optional based on if you set up authenticaiton. Without username/password, it will try onnecting as guest. UID and GID are needed so your computer knows who to assign permissions in the mount folder to. Unlike NFS, SMB doesn't report on the file permissions, so if you don't give a uid and gid, you may be stuck and unable to edit files.

  • scripts/files/mount_smb_nfs_nas_share_in_fstab.txt
  • Last modified: 2022-04-06 21:55
  • by Tony