Contents
Auto-mount Samba / CIFS shares via fstab on Linux
- Install dependencies. Install the necessary “cifs-utils” with the package manager of your choice e.g. DNF on Fedora.
- Create mountpoints.
- Create a credentials file (optional)
- Edit /etc/fstab.
- Manually mount the share for testing.
How do you mount a CIFS mount?
To mount a Windows share on a Linux system, first you need to install the CIFS utilities package.
- Installing CIFS utilities on Ubuntu and Debian: sudo apt update sudo apt install cifs-utils.
- Installing CIFS utilities on CentOS and Fedora: sudo dnf install cifs-utils.
Do you need to use fstab to Mount CIFS?
If you don’t want hacks and use the builtin advanced mounting features, you need to use /etc/fstab and never look back. noauto will stop the no-brainer actions like forcibly mounting whatsoever at booting regardless if the network is up or not.
Can a CIFS share be mounted at boot?
I have a CIFS share on my NAS that I want to have mounted at boot – it’s used by my MythTV server as the main media store. I added an entry into fstab to have it mount but it doesn’t.
What to do when mount fails in fstab file?
This way, even though the network is NOT connected yet when the system first reads the fstab file, so the mount fails then, I force the system to wait 20 seconds here (giving the network time to connect) then I force it to call mount -a again to mount all drives in the fstab file.
Auto-mount Samba / CIFS shares via fstab on Linux. 1 1. Install dependencies. Install the necessary “cifs-utils” with the package manager of your choice e.g. DNF on Fedora. 2 2. Create mountpoints. 3 3. Create a credentials file (optional) 4 4. Edit /etc/fstab. 5 5. Manually mount the share for testing.