Automount for Raspberry Pi SMB Server

I use Archlinux and have a RPi3 that runs a Samba server as my homebew NAS.
To automatically mount the NAS drive when accessed, one could use automount as described below:

Step 1

sudo pacman -S smbclient
sudo mkdir /mnt/rpi3
sudo chown $(whoami) /mnt/rpi3

Step 2

Run sudo nano /etc/systemd/system/mnt-rpi3.mount and save the following content in it. Before you save it, replace:

[Unit]
  Description=rpi3 smb mounter
  Requires=network-online.target
  After=network-online.service
[Mount]
  What=//192.168.100.111/rpi3
  Where=/mnt/rpi3
  Options=uid=saleh,username=YOUR_NAS_USER,password=YOUR_PASSWORD
  Type=cifs
[Install]
  WantedBy=multi-user.target

Step 3

Run sudo nano /etc/systemd/system/mnt-rpi3.automount and save the following content in it:

[Unit]
Description=Automount rpi3
[Automount]
Where=/mnt/rpi3/
TimeoutIdleSec=3600
[Install]
WantedBy=multi-user.target

Step 4

Enable and start the service:

sudo systemctl enable mnt-rpi3.automount
sudo systemctl start mnt-rpi3.automount
sudo systemctl status mnt-rpi3.automount

If everything runs normally, browsing into /mnt/rpi3 on your file manager should automatically mount your NAS drive without any prompt of any kind.

Arch WIKI - SMB

RPI3 NAS

Automount