How to mount Network Storage with fstab

The user @raknie made an how to:

Persistent SMB Mount via fstab + systemd

  1. Install the packages
sudo pacman -S cifs-utils

  1. Create a credentials file (to avoid plain-text passwords in fstab)
sudo nano /etc/smbcredentials

Add:

username=your_nas_username
password=your_nas_password

Secure it:

sudo chmod 600 /etc/smbcredentials

  1. Create mount points
sudo mkdir -p /mnt/nas1
sudo mkdir -p /mnt/nas2

  1. Edit /etc/fstab
sudo nano /etc/fstab

Add entries like this for each NAS:

//NAS_IP_OR_HOSTNAME/sharename /mnt/nas1 cifs credentials=/etc/smbcredentials,uid=1000,gid=1000,iocharset=utf8,vers=3.0,_netdev,nofail,x-systemd.automount 0 0

  1. Test the mount
sudo systemctl daemon-reload
sudo mount -a

  1. Create symlinks in your home directory (optional)
ln -s /mnt/nas1 ~/NAS1

i was gonna publish after i find the solution for last thing to be added but tysm :light_blue_heart:

one extra thing is if you want to unmount/mount in dolphin instead of just automount

this solution will help BUT its little bit clunky so you either live with “harmless error“ or remove automount

Start these steps after completing basic setup step 8.


Step 1: Update fstab Options

sudo nano /etc/fstab

Change your entry to includeusers andip=:

//hostname.local/sharename /mnt/nasname cifs users,credentials=/etc/smbcredentials_nasname,ip=192.168.x.x,uid=1000,gid=1000,iocharset=utf8,vers=3.0,_netdev,nofail,x-systemd.automount 0 0

Step 2: Fix Credentials Permissions

sudo chown root:yourusername /etc/smbcredentials_nasname
sudo chmod 640 /etc/smbcredentials_nasname

if you want to add multiple NASs :

sudo chown root:yourusername /etc/smbcredentials*
sudo chmod 640 /etc/smbcredentials*

Step 3: Apply Changes

sudo umount -l /mnt/nasname
sudo systemctl daemon-reload
sudo mount -a

Step 4: If NAS Disappears from Dolphin Sidebar

sudo systemctl start mnt-nasname.automount

now it should be mounted but if you want to unmount →wait a sec → click again on unmount now its unmounted

and after mounting , you may see:

An error occurred while accessing 'HA', the system responded: mount error(16): Device or resource busy
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)

This is harmless — share is already mounted.

Withx-systemd.automount, Dolphin unmount works like this:

  • First unmount → share unmounts but automount watcher stays active

  • Clicking folder → immediately remounts

  • Second unmount → fully stops automount watcher