Automatically mount

Edit the /etc/fstab file

1
2
3
sudo vim /etc/fstab

//xxx.xx.xx.xx/FileStorage /mnt/smb cifs credentials=/home/[user_name]/smbcredentials,vers=3.1.1,x-systemd.automount,_netdev 0 0

Modify the permission of the credential file

1
sudo chmod 600 /home/[user_name]/smbcredentials

Check whether the mount-point is available or not

1
sudo cat /etc/mtab | grep cifs

Remove all existing mount-record

1
sudo umount -l /mnt/smb

Remount

1
2
sudo systemctl daemon-reload
sudo mount -a

Confirm the mount result

1
2
3
4
5
6
7
8
9
10
11
12
df -hT

user@localhost:~$ df -hT
Filesystem Type Size Used Avail Use% Mounted on
tmpfs tmpfs 13G 4.6M 13G 1% /run
/dev/sdc4 ext4 5.2T 2.0T 3.1T 39% /
tmpfs tmpfs 63G 4.0K 63G 1% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/sdc2 ext4 974M 245M 663M 27% /boot
/dev/sdc1 vfat 1.1G 6.1M 1.1G 1% /boot/efi
tmpfs tmpfs 13G 4.0K 13G 1% /run/user/1000
//xxx.xx.xx.xx/FileStorage cifs 2.5T 2.4T 151G 95% /mnt/smb