• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

CIFS Share Filesystem Is Not Mounted after Reboot on CentOS/RHEL 7

by admin

The Problem

CIFS shared file system is not mounted even after system reboot in CentOS/RHEL 7. If manually execute the “mount -a” command after the system is rebooted, the CIFS file system is normally mounted

fstab entry:

# cat /etc/fstab
//192.168.0.10/Oracle /backup/oracle cifs _netdev,noexec,nosuid,vers=3.0,uid=1001,gid=1002,credentials=/root/backup_creds 0 0

demsg:

[ 27.052981] Key type cifs.idmap registered
[ 33.053711] CIFS VFS: Error connecting to socket. Aborting operation.
[ 33.054048] CIFS VFS: cifs_mount failed w/return code = -113

/var/log/messages:

Nov 21 15:09:29 ***** kernel: CIFS VFS: Error connecting to socket. Aborting operation.
Nov 21 15:09:29 ***** kernel: CIFS VFS: cifs_mount failed w/return code = -113
Nov 21 15:09:29 ***** mount: Unable to find suitable address.
Nov 21 15:09:29 ***** systemd: backup-oracle.mount mount process exited, code=exited status=32
Nov 21 15:09:29 ***** systemd: Failed to mount /backup/oracle.
Nov 21 15:09:29 ***** systemd: Dependency failed for Remote File Systems.
Nov 21 15:09:29 ***** systemd: Job remote-fs.target/start failed with result 'dependency'.
Nov 21 15:09:29 ***** systemd: Unit backup-oracle.mount entered failed state.

The Solution

Mount units referring to local and network file systems are distinguished by their file system type specification. In some cases, this is not sufficient (for example network block device based mounts, such as iSCSI), in which case _netdev may be added to the mount option string of the unit, which forces systemd to consider the mount unit a network mount.

Additionally, systemd supports explicit order dependencies between mount entries and other units. There are 2 ways this issue can be resolved:

1. adding in x-systemd.after=network-online.target in /etc/fstab to the mount options:

//192.168.0.10/Oracle /backup/oracle cifs _netdev,x-systemd.after=network-online.target,noexec,nosuid,vers=3.0,uid=1001,gid=1002,credentials=/root/backup_creds 0 0

2. create custom systemd unit file in /etc/systemd/system with file format samba.service[Unit]:

# vi /etc/systemd/system
Description=CIFS Mount
Requires=network-online.target
After=network-online.service
Before=samba.service
[Mount]
What=//xxx.xxx.xxx.xxx/path/[mountpoint]
Where=/mnt/path
Options=username=yourusername,pass=yourpassword
Type=cifs

[Install]
WantedBy=multi-user.target

Filed Under: CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. How to configure multicast on an IP address (interface)
  2. “su: Authentication failure” – in Docker
  3. daemon: command not found
  4. nice: command not found
  5. modprobe Command Options
  6. acpi Command Examples in Linux
  7. How to Clone Linux disk partition over network using dd
  8. ebuild Command Examples in Linux
  9. Passwordless SSH not working for local users on LDAP servers – CentOS/RHEL 7
  10. CentOS / RHEL : How to make iptable rules persist across reboots

You May Also Like

Primary Sidebar

Recent Posts

  • fprintd-delete Command Examples in Linux
  • fprintd-delete: command not found
  • foreman: command not found
  • foreman Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright